fix(har-derived-api-client): handle postData: null in HAR entries - #84977
thaingo72-ctrl wants to merge 1 commit into
Conversation
req.get("postData", {}) returns None when a HAR entry explicitly has
postData: null (common for GET-only requests), crashing har_to_client.py
with AttributeError: 'NoneType' object has no attribute 'get'. Use
req.get("postData") or {} so null and absent both become an empty dict.
Failed --action specs IndexError and skip context.close(), so the HAR never lands. CDP attach drives pages[0] (and --goto navigates it), and derivation drops form params and base64 response bodies. Share a validated run_action helper (bad specs fail with a clear ValueError, including empty selectors), flush the Playwright HAR in finally, listen on every CDP context, and open a new tab for --goto so it cannot wipe the tab Hermes is driving. In-flight requests left after --wait are flushed as entries with a null response, after detaching the listeners. Calling the waiting request.response() there could hang the capture (no timeout) or record a late response twice. har_to_client now reads params-only postData and decodes base64 content. Does not change header redaction, scheme printing, or CDP queryString (NousResearch#85053). Null postData is handled by the new body helper, which supersedes NousResearch#84977.
fix(har-derived-api-client): handle postData: null in HAR entries
|
Failed --action specs IndexError and skip context.close(), so the HAR never lands. CDP attach drives pages[0] (and --goto navigates it), and derivation drops form params and base64 response bodies. Share a validated run_action helper (bad specs fail with a clear ValueError, including empty selectors), flush the Playwright HAR in finally, listen on every CDP context, and open a new tab for --goto so it cannot wipe the tab Hermes is driving. In-flight requests left after --wait are flushed as entries with a null response, after detaching the listeners. Calling the waiting request.response() there could hang the capture (no timeout) or record a late response twice. har_to_client now reads params-only postData and decodes base64 content. Does not change header redaction, scheme printing, or CDP queryString (NousResearch#85053). Null postData is handled by the new body helper, which supersedes NousResearch#84977.
Summary
har_to_client.pycrashes withAttributeError: 'NoneType' object has no attribute 'get'when a HAR entry contains"postData": null— which is common for GET-only requests (Chrome/Playwright HARs include the key explicitly with a null value).req.get("postData", {})only defaults when the key is absent, not when it's explicitly null.Fix
req.get("postData") or {}— null and absent both become an empty dict.Verification
postData: null→ crash at line 91