Open
Description
Version
latest
Steps to reproduce
cant get content of file uploaded
Expected behavior
get asdasdasd in post_data
Actual behavior
in pyptteer i can get this content with
await cdp.send("Network.enable", {
# Buffer up to 10 MB of POST/PUT data
"maxPostDataSize": 0
})
async def on_request_will_be_sent(params):
try:
req = params["request"]
if req.get("method") == "PUT" and "/api/file/raw" in req.get("url", ""):
request_id = params["requestId"]
# Ask Chrome: “Please give me the POST/PUT payload that you buffered.”
resp = await cdp.send(
"Network.getRequestPostData",
{"requestId": request_id}
)
body = resp.get("postData", None)
print("→ Caught PUT to /api/file/raw via Network:")
print(" • request.postData →", body)
# If you want bytes instead of a string, do:
# raw_bytes = body.encode("utf-8")
# print(" • as bytes:", raw_bytes)
except Exception as e:
# If "No post data available" still shows up, check that `maxPostDataSize` was set early enough.
print("ERROR in on_request_will_be_sent:", e)
cdp.on("Network.requestWillBeSent", lambda event: asyncio.create_task(on_request_will_be_sent(event)))
Additional context
No response
Environment
- Operating System: [Ubuntu 22.04]
- CPU: [arm64]
- Browser: [All, Chromium, Firefox, WebKit]
- Python Version: [3.12]
- Other info:
Metadata
Metadata
Assignees
Labels
No labels