API (v2.0.0) - Giro3D
    Preparing search index...
    httpConfiguration: {
        applyConfiguration: (
            input: URL | RequestInfo,
            options?: RequestInit,
        ) => RequestInit | undefined;
        clear: () => void;
        setAuth: (urlPrefix: string, value: string) => void;
        setHeader: (urlPrefix: string, name: string, value: string) => void;
        setOptions: (urlPrefix: string, options: Partial<RequestInit>) => void;
    }

    Contains configuration for HTTP requests.

    Configuration is based on URL prefixes: each configuration entry applies to an URL prefix and will apply to any URL that matches this prefix. Longer prefixes have more precedence over shorter ones, so that you can cascade configurations. For example, you can have a general configuration for the example.com domain, then more specific configuration entries for sub-paths in the same domain.

    Note: URL prefixes must be valid absolute URLs (including scheme): http://example.com/foo is a valid prefix, but example.com/foo is not.

    Note: If you plan to use the same configuration for different schemes (e.g http and https, you must register the configuration twice, one for each scheme).

    Important: this module do not automatically process outgoing HTTP requests. It is not a service worker or a middleware. The Fetcher module automatically processes the requests by querying configuration from this module, but if you can't or don't want to use Fetcher, then you have to patch the request yourself (see the example below).

    Type Declaration

    • applyConfiguration: (input: URL | RequestInfo, options?: RequestInit) => RequestInit | undefined
    • clear: () => void
    • setAuth: (urlPrefix: string, value: string) => void
    • setHeader: (urlPrefix: string, name: string, value: string) => void
    • setOptions: (urlPrefix: string, options: Partial<RequestInit>) => void
    // Set the `Accept-Language` header to `fr-CH` for all requests under `http://example.com`.
    HttpConfiguration.setHeader('http://example.com', 'Accept-Language', 'fr-CH');

    // Later, query the configuration for a resource under `http://example.com`
    const fetchOptions = HttpConfiguration.applyConfiguration('http://example.com/myPage.html');

    // And put the options in the fetch request.
    fetch('http://example.com/myPage.html', fetchOptions);