-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Request header "Content-Type: application/json; charset=test" cause an error #3562
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #1011 (POST with application/json headers), #3242 (Error), #2206 (json request for certain media types fail), #2120 (Invalid content-type header causes LookupError), and #1197 (Flask request headers). |
Thanks for the report. |
Agree, 415 is appropriate |
request.charset no longer causes ValueError. request.read and request.post raises HTTPUnsupportedMediaType. Unit test test_content_type_from_spec_with_bad_charset was removed.
* Raise 415 status code in case of invalid Content-Type encoding (#3562) * Unit tests for #3562 * Сorrections after review (#3562) request.charset no longer causes ValueError. request.read and request.post raises HTTPUnsupportedMediaType. Unit test test_content_type_from_spec_with_bad_charset was removed.
Fixed by #3564 |
Long story short
Request's header Content-Type encoding have not validated properly.
bytes_body.decode(encoding) raise as error "LookupError: unknown encoding: test"
Expected behaviour
Status code 415 or 422
Encoding have to be limited with standard encodings.
Actual behaviour
Steps to reproduce
Your environment
aiohttp==3.5.4
Python 3.7.0
The text was updated successfully, but these errors were encountered: