wrappers.py:129: BadRequest flask:2.0.3 #4508
-
|
Hi, I fixed flask version from 2.0.0 to 2.0.3 because I encountered the same problem #4341 After above fixing, I try to debug below statement. best regards. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
app/views/error_handler.py:18: in custom_client_error_handler
current_app.logger.warning(exception, extra=dict(extra_data=to_extra_data()))
app/views/error_handler.py:46: in to_extra_data
json_body=request.json,
/usr/local/lib/python3.8/site-packages/werkzeug/wrappers/request.py:540: in json
return self.get_json()Looks like you have a In pallets/werkzeug#2355, accessing So you could change line |
Beta Was this translation helpful? Give feedback.
app/views/error_handler.py:18: in custom_client_error_handler current_app.logger.warning(exception, extra=dict(extra_data=to_extra_data())) app/views/error_handler.py:46: in to_extra_data json_body=request.json, /usr/local/lib/python3.8/site-packages/werkzeug/wrappers/request.py:540: in json return self.get_json()Looks like you have a
custom_client_error_handlermethod that callsto_extra_datafor logging. That callsrequest.jsonunconditionally.In pallets/werkzeug#2355, accessing
jsonnow raises a 400 error instead of returningNoneif the request is not well formed. You can usesilent=Trueto make it returnNoneinstead, or you can userequest.is_jsoninstead to check if t…