mistercrunch commented on code in PR #27943:
URL: https://github.com/apache/superset/pull/27943#discussion_r1558123366


##########
superset/utils/log.py:
##########
@@ -47,10 +47,12 @@ def collect_request_payload() -> dict[str, Any]:
 
     payload: dict[str, Any] = {
         "path": request.path,
-        **request.form.to_dict(),
-        # url search params can overwrite POST body
-        **request.args.to_dict(),
     }
+    payload.update(**request.form.to_dict())
+    payload.update(**request.args.to_dict())
+    if request.is_json:
+        json_payload = request.get_json(cache=True, silent=True)

Review Comment:
   NOTE: here I discovered 2 important things:
   - the logging framework, that inspects the `flask.request` object to gather 
context, was missing out on `request.json` which in many cases has rich context 
to read from
   - `request.json` is a stream and can only be read once reliably, after which 
it'll show as empty. Here using `get_json(cache=True)` ensures the process can 
read it later in the execution flow.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to