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

[6.x] Add ValidateJson middleware #5127

Closed

Conversation

@gepeixoto
Copy link

gepeixoto commented Oct 7, 2019

Every time I start a new API project, I create a simple middleware to verify JSON on incoming requests’ body.
Even considering it is simple, it is useful to inspect the payload integrity and, in case of a not valid JSON input, the middleware returns a more descriptive error (good for API consumers), saving resources by avoiding to getting deep in the application.
Considering that Laravel is used for so many JSON API projects, I think it would be good to have this out-of-the-box, by just enabling it in Kernel file.

@taylorotwell

This comment has been minimized.

Copy link
Member

taylorotwell commented Oct 8, 2019

Feel free to release this as a package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.