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
reqparse raises on any non-JSON request with Werkzeug 2.1.0 #936
Comments
Confirmed. Additionally, setting |
Setting |
@emosenkis That's a clever way to do that! However, after spending some hours investigating this I'm still unable to get the As an aside, props to Github tox workflows that caught this for me (although I spent an hour assuming that I had broken something when I checked in some project documentation changes) ;-) |
As workaround downgrading to Werkzeug 2.0.3 does the trick. |
I ended up moving to marshmallow for my query param parsing. It was very straight-forward. I'm still using Flask-RESTful for its |
It seems like Flask-Restful isn't actively maintained anymore according to #883, which lists alternatives, including Marshmallow in place of reqparse. Flask-Restx seems to be based on the similar code, and has this PR open: python-restx/flask-restx#423. The same could be applied here. Given that this isn't actively maintained, it's likely that other things will continue to diverge in incompatible ways. So if you're still using Flask-Restful, it's a very good idea to pin your dependency tree to avoid updates. Or migrate to the suggested alternatives (and still pin to control updates). |
I've submitted a potential fix for this issue. FWIW, I also reported the issue at werkzeug (pallets/werkzeug#2339), as there may be other broken things, and it took me a bit to narrow down where the problem was. [edit: I'm a dork and didn't get the link right for the issue] |
There were several issues with these tests preventing them from working. * The parallelism caused port collision despite using a random port * The `run_before` section in tox.ini caused several issues in parallel as it was killing the testing harness for other tests while running * There is a bug in flask-restful which prevents it from correctly parsing args if you do not specify location and are running inside a virtual environment. flask-restful/flask-restful#936 * Moto changed it's testing signature requiring arity of two. * The psycopg2 manually installed version doesn't seem to work correctly in the tests and there are comments saying as much
There were several issues with these tests preventing them from working. * The parallelism caused port collision despite using a random port * The `run_before` section in tox.ini caused several issues in parallel as it was killing the testing harness for other tests while running * There is a bug in flask-restful which prevents it from correctly parsing args if you do not specify location and are running inside a virtual environment. flask-restful/flask-restful#936 * Moto changed it's testing signature requiring arity of two. * The psycopg2 manually installed version doesn't seem to work correctly in the tests and there are comments saying as much
It seems that letting |
flask-mongoengine and flask-restful have issues with flask and werkzeug latest release. See flask-restful/flask-restful#936 and MongoEngine/flask-mongoengine#522
Werkzeug 2.1.0 makes
Request.get_json()
raise if request is not JSON, which causes reqparse to raise when it attempts to accessRequest.json
, which it does by default for all arguments without a specified location.The text was updated successfully, but these errors were encountered: