Open
Description
I want to handle the MothodNotAllowed Exception by that code:
@api.errorhandler(MethodNotAllowed)
def method_not_allowed(e):
resp = err_resp('该请求方法不允许', 405, 'The method is not allowed for the requested URL.', {})
return resp
The err_resp()
return that:
{
"succeed": false,
"msg": "该请求方法不允许",
"code": 405,
"extra": "The method is not allowed for the requested URL.",
"errors": {},
}
But actually I get that response:
{
"succeed": false,
"msg": "该请求方法不允许",
"code": 405,
"extra": "The method is not allowed for the requested URL.",
"errors": {},
"message": "405 Method Not Allowed: The method is not allowed for the requested URL."
}
The api.errorhandler
derector automatically add message
field to my response, but I don't need that.
Is there a way to return a plain response without message
field when handle exception?
Thanks!