Flask-restful: Automatically adding a "message" field to api.abort responses

Created on 22 May 2015  路  6Comments  路  Source: flask-restful/flask-restful

This is my code:
abort(http_status_code=404, errors='Not found')

And the response is:

{
    "error": 'Not found',
    "message": "You have requested this URI [/foo] but did you mean /foo-bar or /foo-bar2 ?"
}

Seems wrong for the framework to auto-magically add fields to the response object.

Looks like the same issue was closed as fixed in https://github.com/flask-restful/flask-restful/issues/67, but I still see it in 0.3.2.

docs

Most helpful comment

Try setting ERROR_404_HELP to False in your app config.

All 6 comments

yup, me too seeing it in 0.3.2... and added my comments #67 .

Try setting ERROR_404_HELP to False in your app config.

and do you mean to do it for each and every http error code?

That did it. Thanks @joshfriend! Is it documented anywhere?

It does not appear to be documented. I've re-opened as a reminder to write it down somewhere.

Was this page helpful?
0 / 5 - 0 ratings