@freedomofpress/webcat
    Preparing search index...

    Class BlockingResponse

    The response of a single listener to a blocking RequestEvent, created with RequestEvent.createBlockingResponse. Implements the Disposable interface. A new BlockingResponse cancels the request; a listener signals successful completion by setting cancel to false, either by assigning to it directly or with the set method. A listener must create it with a using declaration before its first await expression; the response is reported on disposal.

    handler.addEventListener("beforeheaders", async (event) => {
    using blockingResponse = event.createBlockingResponse();
    await doSomething(event.details);
    blockingResponse.cancel = false;
    });

    Implements

    Index
    authCredentials?: _BlockingResponseAuthCredentials

    Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials.

    cancel: boolean | undefined = true

    Whether to cancel the request. Defaults to true, so that a listener that throws, or never completes its checks, cancels the request. Set to false to signal successful completion.

    redirectUrl?: string

    Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method.

    requestHeaders?: HttpHeaders

    Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead.

    responseHeaders?: HttpHeaders

    Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these response headers instead. Only return responseHeaders if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify responseHeaders for each request).

    upgradeToSecure?: boolean

    Only used as a response to the onBeforeRequest event. If set, the original request is prevented from being sent/completed and is instead upgraded to a secure request. If any extension returns redirectUrl during onBeforeRequest, upgradeToSecure will have no affect.

    • Sets the response header name to value, replacing any existing occurrences. Starts from the response's original headers, so the rest pass through unchanged.

      Parameters

      • name: string
      • value: string

      Returns void