[Bug]: Missing Content Type returns 500 Internal Server Error instead of 415 Unsupported Media Type #11171
Closed
1 task done
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Your current environment
The output of `python collect_env.py`
Model Input Dumps
No response
🐛 Describe the bug
This is essentially a "remainder" from this issue. Pydantic validates the protocol, but you guys forgot to check whether the data you pass through pydantic is actually a JSON document, so it just crashes in a random place.
Note that the error message itself is completely meaningless, since it really is just complaining that it interpreted the request body as an array of bytes rather than parse it into a class object. The error location is just the first place where it had the opportunity to crash. What you will have to do is reject the request with the HTTP status code 415 Unsupported Media Type
Before submitting a new issue...
The text was updated successfully, but these errors were encountered: