fusionauth-issues
fusionauth-issues copied to clipboard
Provide better errors on API when Content-Type header is missing
Description
Currently, FusionAuth fails at random when the Content-Type header is missing for any API calls. It also sometimes returns a 500
status code because the code might not be prepared for for invalid HTTP requests like this.
We should prevent this by implementing a Content-Type
requirement for specific URL patterns. In this case, if we require this header for anything under /api
, it would prevent the explosions and allow us to return a proper HTTP status code like 400
plus an error message.
Saw this again today with a nullpointerexception. In this case, it was because a Content-Type
header was provided for a GET request with a value of application/json
with a JSON body.
We should avoid 5xx errors when the wrong content type is provided. That is pretty common.