BaseFetchInterception

open class BaseFetchInterception(tab: Tab, val urlPattern: String, val requestStage: Fetch.RequestStage, val resourceType: Network.ResourceType) : FetchInterception

Default implementation of FetchInterception.

Constructors

Link copied to clipboard
constructor(tab: Tab, urlPattern: String, requestStage: Fetch.RequestStage, resourceType: Network.ResourceType)

Properties

Link copied to clipboard
open override val requestStage: Fetch.RequestStage
Link copied to clipboard
Link copied to clipboard
open override val urlPattern: String

Functions

Link copied to clipboard
open suspend override fun continueRequest(url: String?, method: String?, postData: String?, headers: List<Fetch.HeaderEntry>?, 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<Fetch.HeaderEntry>?, 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: Network.ErrorReason)

Causes the request to fail with specified reason.

Link copied to clipboard
open suspend override fun fulfillRequest(responseCode: Int, responseHeaders: List<Fetch.HeaderEntry>?, 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 getRequestEvent(): Fetch.RequestPausedParameter

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 <R> use(block: suspend FetchInterception.() -> R): R

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