Module network

Module network 

Source
Expand description

Network interception types. Network interception types.

Types for request/response interception callbacks.

§Request Interception

use firefox_webdriver::RequestAction;

let intercept_id = tab.intercept_request(|req| {
    if req.url.contains("ads") {
        RequestAction::block()
    } else {
        RequestAction::allow()
    }
}).await?;

§Response Interception

use firefox_webdriver::BodyAction;

let intercept_id = tab.intercept_response_body(|res| {
    if res.url.contains("config.json") {
        BodyAction::modify_body(r#"{"modified": true}"#)
    } else {
        BodyAction::allow()
    }
}).await?;

Structs§

InterceptedRequest
Data about an intercepted network request.
InterceptedRequestBody
Data about an intercepted request body (read-only, cannot be modified).
InterceptedRequestHeaders
Data about intercepted request headers.
InterceptedResponse
Data about an intercepted network response.
InterceptedResponseBody
Data about an intercepted response body.

Enums§

BodyAction
Action to take for intercepted response body.
HeadersAction
Action to take for intercepted headers.
RequestAction
Action to take for an intercepted request.
RequestBody
Request body data.

Type Aliases§

ResponseAction
Action to take for intercepted response headers.