Skip to main content

Module api_request

Module api_request 

Source
Expand description

Standalone HTTP client mirroring Playwright’s APIRequestContext / APIResponse.

Unlike crate::Request/crate::Response (which represent network traffic captured inside the browser page), an APIRequestContext is a direct HTTP client — useful for exercising APIs alongside browser automation. It carries a single shared reqwest::Client and a set of default headers, and exposes the usual get/post/put/… verbs.

Obtain one via crate::Page::request or crate::BrowserContext::request.

Structs§

APIRequestContext
A standalone HTTP client. Cheap to clone — it shares one underlying reqwest::Client and a set of default headers.
APIResponse
A captured HTTP response. The full body is read once at construction and cached, so APIResponse::body, APIResponse::text, and APIResponse::json are cheap and re-entrant.
ApiRequestContextOptions
Configuration for building an APIRequestContext.