-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add input parsing #28
Labels
Milestone
Comments
This was referenced May 28, 2016
@jsocol - The error HTTP status code should be 415 UNSUPPORTED MEDIA TYPE (see description) The most commonly used content-types to send data in a request are:
I can give a pull request to add decorator json_request, which will handle these cases and consider other cases as UNSUPPORTED MEDIA TYPE. |
Thanks @nitinbhojwani, I'd love to see that PR. A couple of thoughts ahead of time:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple decorator that would do something like this:
Not 100% sure how to handle other content-types yet. That's probably got to go into some sort of setting. Do you always want to assume JSON (e.g. try to parse it regardless of the content-type header) or respect the header? If it does respect the header, does it make sense to assign
request.data = request.POST
if content-type is set toapplication/x-www-form-urlencoded
? What's the right error-handling if you can't parse JSON (or form-encoded)?400
?The text was updated successfully, but these errors were encountered: