flask-rest-jsonapi
flask-rest-jsonapi copied to clipboard
wrong status code from jsonapi_exception_formatter
trafficstars
When I make a POST request to an endpoint with an empty body, the jsonapi_exception_formatter decorator returns an exception with status code 500 instead of 400.
This only happens when app.config['DEBUG'] = False.
I found that the reason this happens is because in the jsonapi_exception_formatter function in decorators.py, the make_response's error code is set to exc.status, which in this case is None, if I set it to exc.code, it works as expected, returning an HTTP error with status code 400.
I'm not sure whether it's just me or whether this should be changed.