-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
pallets/werkzeug#2339 changed the behavior of Request.get_json()
and the Request.json
property to raise a BadRequest
if Request.get_json()
is called, or the Request.json
property
is accessed and the content type is not application/json
.
Repro Steps (if applicable)
- Install Werkzeug >= 2.1.0
- Call
parse()
on anArgument
instance that is from aRequest
that is NOT content typeapplication/json
Expected Behavior
Argument should be parsed from the query string.
Actual Behavior
raises
werkzeug.exceptions.BadRequest: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
Error Messages/Stack Trace
File "./rest/api/v1/endpoints/services.py", line 207, in get
args = SERVICES_PARSER.parse_args()
File "./.tox/py38/lib/python3.8/site-packages/flask_restx/reqparse.py", line 386, in parse_args
value, found = arg.parse(req, self.bundle_errors)
File "./.tox/py38/lib/python3.8/site-packages/flask_restx/reqparse.py", line 215, in parse
source = self.source(request)
File "./.tox/py38/lib/python3.8/site-packages/flask_restx/reqparse.py", line 149, in source
value = getattr(request, l, None)
File "./.tox/py38/lib/python3.8/site-packages/werkzeug/wrappers/request.py", line 540, in json
return self.get_json()
File "./.tox/py38/lib/python3.8/site-packages/werkzeug/wrappers/request.py", line 571, in get_json
return self.on_json_loading_failed(None)
File "./.tox/py38/lib/python3.8/site-packages/flask/wrappers.py", line 133, in on_json_loading_failed
raise BadRequest() from e
werkzeug.exceptions.BadRequest: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
Environment
- Python version: CPython 3.8.12
- Flask version: 2.1.0
- Flask-RESTX version: 0.5.1
- Other installed Flask extensions: N/A
- Werkzeug: 2.1.0
andrewmwilson, doumdi, arne-heil, icemanmuc, abompard and 9 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working