Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE method can not have an input_filter #5

Open
weierophinney opened this issue Dec 31, 2019 · 3 comments
Open

DELETE method can not have an input_filter #5

weierophinney opened this issue Dec 31, 2019 · 3 comments
Labels
Enhancement New feature or request Help Wanted

Comments

@weierophinney
Copy link
Contributor

Because of ContentValidationListener.php:63 it is not possible to validate the body of a DELETE request (contrary to the README.md).

IMHO the implementation is wrong, DELETEcan have a body according to RFC 7231, so DELETE should be removed from ContentValidationListener::methodsWithoutBodies.


Originally posted by @BreiteSeite at zfcampus/zf-content-validation#60

@weierophinney weierophinney added Enhancement New feature or request Help Wanted labels Dec 31, 2019
@weierophinney
Copy link
Contributor Author

@BreiteSeite 👍🏻 for the above. DELETE usually only requires a request body when removing many entries at once from a list (for a collection). So, based on that, something similar to the following could be added to the content validation listener (ContentValidationListener) in the function onRoute(MvcEvent $e):

...
if (in_array($method, $this->methodsWithoutBodies)) {
    if ($method === 'DELETE') {
        if (isset($this->restControllers[$controllerService])) {
            $identifierName = $this->restControllers[$controllerService];
        } else {
            $identifierName = 'id';
        }

        if ($routeMatches->getParam($identifierName)) {
            return;
        }
    } else {
        return;
    }
}
...

Originally posted by @Nastron at zfcampus/zf-content-validation#60 (comment)

@weierophinney
Copy link
Contributor Author

Now that we have support for GET requests to provide an input filter for collections, we can likely do this for DELETE. I'm marking this as an enhancement, and soliciting help for resolving it; it should be relatively easy to accomplish.


Originally posted by @weierophinney at zfcampus/zf-content-validation#60 (comment)

@weierophinney
Copy link
Contributor Author

@weierophinney I think you could close this issue as in version 1.6.0 DELETE request already supported body (it is removed from ContentValidationListener::methodsWithoutBodies) and implemented that functionality


Originally posted by @developer-devPHP at zfcampus/zf-content-validation#60 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Help Wanted
Projects
None yet
Development

No branches or pull requests

1 participant