Is expected behavior of flask_restful abort() correct ?
Hi. Sorry to post this here - completely new to flask-restful, but ...
From the docs, I expected that flask-restful arg_parse() would return an http page with error code (e.g., 400) + any error messages accumulated while parsing the query string.
However, the error messages do not appear.
I can see that the error messages are accumulating correctly in reqparse.py (e.g., handle_validation_error with bundle_errors=True).
When I look at the flask-restful.abort(), I don't understand how this is meant to work: Inside__init__.py:
def abort(http_status_code, **kwargs):
"""Raise a HTTPException for the given http_status_code. Attach any keyword
arguments to the exception for later processing.
"""
#noinspection PyUnresolvedReferences
try:
original_flask_abort(http_status_code)
except HTTPException as e:
if len(kwargs):
e.data = kwargs
raiseTo me, it looks like you return an original flask abort page with no message, and then raise the flask-restful error message as an exception. How is this meant to work ?
e.g., if I just try to do: import flask_restful flask_restful.abort(400, message={'field1': 'this is required', 'field2': 'got a bad value'})
My understanding from the docs is that this should be all that is required to return html with error messages, but it does not.
Thanks!!
Source: flask-restful/flask-restful