Skip to content

getRequestPostData requires addDataCollector first #214

Description

@XDLCS

Description

Network.getRequestPostData fails with No post data available unless the client first calls Network.addDataCollector on the target scope. In Chromium, getRequestPostData works out of the box for any request whose body was captured — no collector setup is required.

Steps to Reproduce

  1. moli serve and connect over CDP.
  2. Network.enable, then submit a POST (e.g. a fetch('...', {method:'POST', body:'username=alice&pw=s3cret'}) from a page, or a form POST).
  3. Observe Network.requestWillBeSent → the event carries request.postData correctly (event side works). ✅
  4. Call Network.getRequestPostData with that request id (command side). ❌ No post data available.

Actual Behavior

  • Event side (requestWillBeSent.request.postData): body available out of the box (verified: "username=alice&pw=s3cret").
  • Command side (Network.getRequestPostData): returns No post data available unless Network.addDataCollector was issued first (moli-protocol/src/domains/network/backlog.rs:891 record_captured_request_body_with_collector_scope gates the read on collector scope).

Expected Behavior

Network.getRequestPostData should return the captured body without requiring the client to know about/invoke addDataCollector, matching Chromium's semantics. Proposal: fall back to the most recent captured body when no collector scope is present.

Impact

Automation clients (Playwright-style tools, network-inspection harnesses) that only call getRequestPostData get a spurious failure even though the body was captured and is visible in the event stream.

Environment

  • moli (reproduced on v1.0.2 and HEAD)
  • Relevant code: moli-protocol/src/domains/network/network.rs:265,279, response_body.rs:64,112-113,254, backlog.rs:891

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions