Skip to content

platform/electron/request-pipeline

Defined in: app/src/platform/electron/request-pipeline.ts:61

Owns the one onBeforeRequest and the one onHeadersReceived listener that Electron allows per session and asks its interceptors in order: the first decision about a request wins, and every interceptor may add response headers. Requests of the browser’s own pages never pass here, because the pipeline only serves web sessions.

new RequestPipeline(): RequestPipeline

RequestPipeline

add(interceptor): void

Defined in: app/src/platform/electron/request-pipeline.ts:68

Adds an interceptor after the existing ones.

RequestInterceptor

The interceptor.

void

attach(session): void

Defined in: app/src/platform/electron/request-pipeline.ts:76

Routes the requests of a web session through the pipeline.

Session

A session of web content.

void

Defined in: app/src/platform/electron/request-pipeline.ts:8

What an interceptor decides about a request.

readonly optional cancel?: boolean

Defined in: app/src/platform/electron/request-pipeline.ts:10

Cancels the request.

readonly optional redirectURL?: string

Defined in: app/src/platform/electron/request-pipeline.ts:12

Sends the request to another address instead.


Defined in: app/src/platform/electron/request-pipeline.ts:19

One step of the request pipeline, such as the content blocker.

beforeRequest(details): RequestDecision | Promise<RequestDecision | undefined> | undefined

Defined in: app/src/platform/electron/request-pipeline.ts:24

Decides about a request before it starts.

OnBeforeRequestListenerDetails

RequestDecision | Promise<RequestDecision | undefined> | undefined

A decision, or undefined to let the next interceptor decide.

optional headersReceived(details): Readonly<Record<string, readonly string[]>> | undefined

Defined in: app/src/platform/electron/request-pipeline.ts:31

Adds headers to a response, such as a content security policy.

OnHeadersReceivedListenerDetails

Readonly<Record<string, readonly string[]>> | undefined

The headers to add, or undefined for none.

HeaderAdditions = Readonly<Record<string, readonly string[]>>

Defined in: app/src/platform/electron/request-pipeline.ts:16

Headers that an interceptor adds to a response.

addHeaders(headers, additions): Record<string, string[]>

Defined in: app/src/platform/electron/request-pipeline.ts:40

The response headers with more values added. A header that exists under another spelling gets the values under its own name, so no value of the server is lost.

Readonly<Record<string, readonly string[]>>

The headers of the response.

HeaderAdditions

Values to add, by header name.

Record<string, string[]>