Wrong status code and message on responses when handling HTTPException
s
#569
Labels
bug
Something isn't working
HTTPException
s
#569
Issue
There are two issues in
handler_error
method, inapi.py
.HTTPException(some_response)
. The code is in the response, but NOT in the HTTPException. Currently, Flask-RESTX checks gets the code only from the exception itself which will cause an error:getattr
returns the default value (code.phrase
) only ife.description
doesn't exist, which will never happen. It's always set toNone
by default, so it exists.The final result of these problems is that
Reproduction Steps
tests/test_errors.py
. Conveniently it catches both problems.Expected Behavior
The code and message should be set as expected (401, "Unauthorized")
Actual Behavior
Message is set to None, but it doesn't even happen because before that, we get:
ValueError: None is not a valid HTTPStatus
due to code beingNone
.Environment
The text was updated successfully, but these errors were encountered: