Type alias CommonFetchOptions

CommonFetchOptions: {
    attributionReporting?: any;
    cache?: string;
    credentials?: "omit" | "include" | "same-origin";
    dispatcher?: any;
    headers?: string[][] | Record<string, string | ReadonlyArray<string>> | Headers;
    keepalive?: boolean;
    mode?: string;
    priority?: "low" | "high" | "auto";
    redirect?: "error" | "follow" | "manual";
    referrer?: string;
    referrerPolicy?: string;
}

Options available for requests made with the Fetch API.

Type declaration

  • Optional attributionReporting?: any

    (Browser only.) Controls the Attribution Reporting API specific behavior.

    See the MDN Web Docs for more information on the available options.

  • Optional cache?: string

    (Browser only.) Cache mode to use for the request.

    See the Fetch API specification or the MDN Web Docs for more information on the available options.

  • Optional credentials?: "omit" | "include" | "same-origin"

    (Browser only.) Controls sending of credentials and cookies.

    • "omit": Never send cookies.
    • "include": Always send cookies.
    • "same-origin": Only send cookies if the request is to the same origin.

    Default: "same-origin"

  • Optional dispatcher?: any

    (Node.js only.) Undici Dispatcher instance to use for the request.

    Defaults to the global dispatcher.

  • Optional headers?: string[][] | Record<string, string | ReadonlyArray<string>> | Headers

    Headers object containing any additional headers to send with the request.

    Note that the Authorization header will be overridden if the auth configuration option is set.

  • Optional keepalive?: boolean

    Controls whether the socket should be reused for subsequent requests.

    Default: false

  • Optional mode?: string

    (Browser only.) Sets cross-origin behavior for the request.

    See the Fetch API specification or the MDN Web Docs for more information on the available options.

    Default: "cors"

  • Optional priority?: "low" | "high" | "auto"

    (Browser only.) Request priority relative to other requests of the same type.

    See the Fetch API specification or the MDN Web Docs for more information on the available options.

    Default: "auto"

  • Optional redirect?: "error" | "follow" | "manual"

    Controls what to do when the response status code is a redirect.

    • "error": Abort with a network error.
    • "follow": Automatically follow redirects.
    • "manual": Abort with an HttpError.

    Default: "follow"

  • Optional referrer?: string

    Value to use for the Referer header.

    If set to "about:client", the default value for the context in which the request is made will be used.

    Default: "about:client"

  • Optional referrerPolicy?: string

    (Browser only.) Policy to use for the Referer header, equivalent to the semantics of the Referrer-Policy header.

    See the Fetch API specification or the MDN Web Docs for more information on the available options.