Variable httpConfiguration
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;
}
Type Declaration
applyConfiguration: (input: URL | RequestInfo, options?: RequestInit) => RequestInit | undefined
clear: () => void
setAuth: (urlPrefix: 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.comdomain, 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/foois a valid prefix, butexample.com/foois not.Note: If you plan to use the same configuration for different schemes (e.g
httpandhttps, 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
Fetchermodule automatically processes the requests by querying configuration from this module, but if you can't or don't want to useFetcher, then you have to patch the request yourself (see the example below).