Expand description
Network lifecycle objects: Request, Response, WebSocket.
Mirrors Playwright’s client-side Request / Response / WebSocket
classes from packages/playwright-core/src/client/network.ts. Live
object references — listeners hold a Request and can call
request.response().await later; the future resolves when the
response (or failure) is recorded by the backend.
Each lifecycle object wraps an Arc<RequestState> /
Arc<ResponseState> / Arc<WebSocketState>. The same Arc is held
by the per-page network listener loop on every backend; backend
events mutate the inner state through the lock and notify waiters.
Structs§
- Header
Entry - Single header entry preserving original case and duplicate keys.
- NavRequest
Slot - Shared slot for the most recent main-document navigation
Request. - Remote
Addr - Server IP + port. Resolved from CDP
responseReceived.response.remoteIPAddress. - Request
- Live reference to a network request. Mirrors Playwright’s
Request. - Request
Init - Construction parameters for a new
Request. - Request
Sizes - Body / header byte counts for a completed request. Field names mirror
Playwright’s
RequestSizesover the wire (camelCase via serde rename); the Rust field identifiers drop the_sizesuffix so they read cleanly at call sites without all four sharing a postfix. - Request
Timing - Resource timing in milliseconds since
startTime. Sentinel values:start_timeis wall-clock ms (Unix epoch), every other field is-1.0when not measured (matches Playwright’sResourceTiming). - Response
- Response
Init - Security
Details - TLS certificate info. Resolved from CDP
responseReceived.response.securityDetails. - WebSocket
Enums§
- WebSocket
Event - WebSocket
Payload - WebSocket payload — text frames stay as
String, binary frames carry bytes.
Functions§
- body_
unsupported - Returns a
BodyFnthat reports the operation as unsupported. Kept as a typed fallback for any request whose backend genuinely can’t expose its body. (The PlaywrightWebKitbackend fetches bodies viaNetwork.getResponseBody, so it does not use this.) - get_
header_ value - headers_
array_ to_ map - headers_
to_ array
Type Aliases§
- BodyFn
- Backend-supplied async closure that fetches a response body lazily.
Used by
Response::body()so the actualNetwork.getResponseBody(CDP) /network.fetchBodyBytes(BiDi) round-trip happens on demand, not as part of everyresponseReceivedevent. - Headers
- Header map. Lower-case-keyed combined view (matches Playwright’s
headers(): Headersshape). - RawHeaders
Fn - Backend-supplied async closure that fetches actual headers (after
HSTS, cookie injection, redirects). CDP delivers them via push event;
for backends without push, the
Responsecalls this lazily.