-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Werkzeug 2.1.2 Did not attempt to load JSON data #454
Comments
Bit of nasty temporary workaround, but it works for now from flask import Flask as Flask_, Request as Request_
class Request(Request_):
def get_json(self, *args, **kwargs):
kwargs.update(silent=True)
return super().get_json(*args, **kwargs)
class Flask(Flask_):
request_class = Request Then create your flask app using this new |
Think this is a duplicate of #422 ? |
Was about to comment, but then your comment showed up, @peter-doggart – indeed, it is a duplicate. This also occured in https://stackoverflow.com/questions/72157708/flask-restx-request-parser-returns-400-bad-request. The failing line is flask-restx/flask_restx/reqparse.py Line 149 in 88497ce
And the reason is that werkzeug raises if the content type does not match since 2.1: https://github.com/pallets/werkzeug/blob/acb1b04ef2e0ff269dc5313462c341dfaacb1b5b/src/werkzeug/wrappers/request.py#L537-L538 |
Is there any update on a fix for this issue? |
I fixed flask-restx/flask_restx/reqparse.py in my restx-monkey patches. I hope it will help you, feedback is welcome. :) |
This middleware adds
And then
|
Code
Repro Steps (if applicable)
foo
query param set astrue
/false
Expected Behavior
I would expect this to return a just and empty list (i.e. not really do anything)
Actual Behavior
Error Messages/Stack Trace
parse_args
raises this error inreqparse.py
Environment
The text was updated successfully, but these errors were encountered: