-
Notifications
You must be signed in to change notification settings - Fork 5
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
User gets API error "Did not attempt to load JSON data because the request Content-Type was not 'application/json'" #152
Comments
To add to the description by @schuderer: What ended working in the end was to:
|
We found the issue. Apparently the newest version of Werkzeug (2.1) created the error message. When using version 2.0, it should be working smoothly again. |
Hi all! Confirming here both problem and solution. After days of searching, making a downgrade to Werkzeug 2.0.3 was the right answer. Thanks a lot! |
Thank you @KJWeterings and @p-miralles for finding and confirming that pinning Werkzeug 2.0.3 is another workaround (besides changing the type of request, which is not really acceptable in most cases). @ all: Keep in mind that Werkzeug is only meant to be used for debugging (e.g. using the
I'm not sure yet about the underlying causes of the error(s) -- while we could simply change mllaunchpad's debugging API to always use waitress instead, we don't know the root cause, and the underlying change might be something that is currently percolating through the whole WSGI ecosystem and might hit us again at a later time. Werkzeug 2.1 deprecated a lot of stuff, and something in that list appears to bite us via our Edit: related: #140 |
Closed by workaround (#154 ) |
Description
After setting up a new Python environment using Python 3.8 instead of Python 3.6 and reinstalling the dependencies (among which are Flask 2.1.1 and Flask-Restful 0.3.9), calling the API gives the user the error (in JSON):
Did not attempt to load JSON data because the request Content-Type was not 'application/json'
MLLP APIs used to accept both GET and POST, with Form/Param data or a json body.
Tried out several permutations of the RAML definitions and GET/POST requests with different kinds of param/data using the
requests
package and got different errors in the process (The method is not allowed
,Cannot parse JSON body null
), and what ended working in the end was to:Steps to reproduce
I could not reproduce this yet on my own system. I have an MLLP project there using the same versions of everything and I did not get any errors.
The text was updated successfully, but these errors were encountered: