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).
// 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` constfetchOptions = HttpConfiguration.applyConfiguration('http://example.com/myPage.html');
// And put the options in the fetch request. fetch('http://example.com/myPage.html', fetchOptions);
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).