You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #510 - the get_json() change in Werkzeug 2.1.0 pallets/werkzeug#2339 breaks any empty submitted form (not json).
From form.py:
def wrap_formdata(self, form, formdata):
if formdata is _Auto:
if _is_submitted():
if request.files:
return CombinedMultiDict((request.files, request.form))
elif request.form:
return request.form
elif request.get_json():
return ImmutableMultiDict(request.get_json())
If the form is an empty ImmutableMultiDict - it falls into the get_json() code which is then checking that the content-type header has been set to application/json.
Possible solution would be to change elif request.get_json() to elif request.is_json()
Expected Behavior:
Empty form submits should be allowed as they were. In the case of an empty form - None should be returned from the wrapper.
Environment:
Python version: 3.8
Flask-WTF version: 1.0.0
Flask version: 2.1
The text was updated successfully, but these errors were encountered:
Similar to #510 - the get_json() change in Werkzeug 2.1.0 pallets/werkzeug#2339 breaks any empty submitted form (not json).
From form.py:
If the form is an empty ImmutableMultiDict - it falls into the get_json() code which is then checking that the content-type header has been set to application/json.
Possible solution would be to change elif request.get_json() to elif request.is_json()
Expected Behavior:
Empty form submits should be allowed as they were. In the case of an empty form - None should be returned from the wrapper.
Environment:
The text was updated successfully, but these errors were encountered: