BaseFetchInterception

open class BaseFetchInterception(tab: Tab, val urlPattern: String, val requestStage: <Error class: unknown class>, val resourceType: <Error class: unknown class>) : FetchInterception

Default implementation of FetchInterception.

Constructors

Link copied to clipboard
constructor(tab: Tab, urlPattern: String, requestStage: <Error class: unknown class>, resourceType: <Error class: unknown class>)

Properties

Link copied to clipboard
open override val requestStage: <Error class: unknown class>

The stage of the fetch request to intercept (e.g., request or response).

Link copied to clipboard
open override val resourceType: <Error class: unknown class>

The type of resource to intercept (e.g., document, script, etc.).

Link copied to clipboard
open override val urlPattern: String

The URL pattern to match requests and responses.

Functions

Link copied to clipboard
open suspend override fun continueRequest(url: String?, method: String?, postData: String?, headers: List<<Error class: unknown class>>?, interceptResponse: Boolean?)

Continues the request, optionally modifying some of its parameters.

Link copied to clipboard
open suspend override fun continueResponse(responseCode: Int?, responsePhrase: String?, responseHeaders: List<<Error class: unknown class>>?, binaryResponseHeaders: String?)

Continues loading of the paused response, optionally modifying the response headers. If either responseCode or headers are modified, all of them must be present.

Link copied to clipboard
open suspend override fun failRequest(errorReason: <Error class: unknown class>)

Causes the request to fail with specified reason.

Link copied to clipboard
open suspend override fun fulfillRequest(responseCode: Int, responseHeaders: List<<Error class: unknown class>>?, binaryResponseHeaders: String?, body: String?, responsePhrase: String?)

Provides response to the request.

Link copied to clipboard
open suspend override fun getRawResponseBody(): EncodedBody

Fetches the raw response body once it has been received.

Link copied to clipboard
open suspend override fun getRequest(): <Error class: unknown class>

Returns the request once it has been received.

Link copied to clipboard
open suspend override fun getRequestEvent(): <Error class: unknown class>

Returns the request event once it has been received.

Link copied to clipboard
inline suspend fun <T> FetchInterception.getResponseBody(): T

Fetches the response body once it has been received.

Link copied to clipboard
open suspend override fun reset()

Resets the internal state, allowing the interception to be reused.

Link copied to clipboard
open suspend override fun <R> use(block: suspend FetchInterception.() -> R): R

Start intercepting fetch responses matching the pattern, run block, and clean up after.