Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt to fix the issue introduced with the release of Werkzeug 2.1, which no longer returns None when asked for JSON content on a request that does not have the Content-Type header set to "application/json".
Specifically, getattr() on line 125 in reqparse.py was looking for the default locations of json and values. This resulted in a call to json() in werkzeug.request, which in turn called get_json(). That method checks request.is_json, and now throws a BadRequest exception instead of returning None.
Here, I am proposing that flask-restful just perform the same check on request, and if the location is "json", skip it and move on.