pub struct Route { /* private fields */ }Expand description
An intercepted network request, paused in the Fetch domain.
Implementations§
Source§impl Route
impl Route
Sourcepub async fn continue_(
&self,
options: Option<RouteContinueOptions>,
) -> Result<()>
pub async fn continue_( &self, options: Option<RouteContinueOptions>, ) -> Result<()>
Let the request proceed (optionally overriding url/method/headers/body).
Sourcepub async fn fallback(&self) -> Result<()>
pub async fn fallback(&self) -> Result<()>
Let the request proceed to the next matching route (no-op if only one).
Sourcepub async fn fulfill(&self, options: RouteFulfillOptions) -> Result<()>
pub async fn fulfill(&self, options: RouteFulfillOptions) -> Result<()>
Serve a synthetic response.
Sourcepub async fn abort(&self, error_code: Option<&str>) -> Result<()>
pub async fn abort(&self, error_code: Option<&str>) -> Result<()>
Abort the request with a CDP ErrorReason (default "Failed").
Sourcepub async fn fetch(
&self,
options: Option<RouteFetchOptions>,
) -> Result<RouteFetchResponse>
pub async fn fetch( &self, options: Option<RouteFetchOptions>, ) -> Result<RouteFetchResponse>
Perform the intercepted request as a real HTTP request, returning the
response so it can be inspected (and optionally modified) before
fulfill.
Unlike continue_ (which lets the page perform the
request through the browser), fetch issues the request itself via a
standalone reqwest::Client that is entirely outside the page’s CDP
Fetch-domain network interception. It therefore does not re-trigger
any registered route handlers — this is Playwright’s documented
route.fetch semantics, useful for “fetch the real response, then modify
and fulfill”.
The intercepted request’s url/method/headers/post_data are used as the
base; any field set on options overrides the corresponding one.
See: https://playwright.dev/docs/api/class-route#route-fetch