Global configuration of this bundle.

interface Config {
    addProxyRule(rule: ProxyRule): void;
    addTrustedServer(server: TrustedServer): void;
    defaultProxy: undefined | string;
    disableProxySupport: boolean;
    interceptors: {}[];
    maxUrlLength: number;
    proxyRules: { origin: string; proxyUrl?: string }[];
    registerInterceptor(interceptor: Interceptor): Handle;
    removeProxyRule(rule: Pick<ProxyRule, "origin">): void;
    removeTrustedServer(server: Pick<TrustedServer, "origin">): void;
    timeoutMillis: number;
    trustedServers: { origin: string }[];
}

Properties

defaultProxy: undefined | string

The default proxy to use.

disableProxySupport: boolean

If this is true, proxy support will be completely disabled.

interceptors: {}[]

Globally registered interceptors.

maxUrlLength: number

Maximum length of an url before a GET request is switched to POST (if supportsPostSwitching is true for a request). GET requests altered in this way will have their query parameters placed into the new POST request's body (as content-type application/x-www-form-urlencoded).

Switching to POST requests can be disabled entirely by setting this property to a value <= 0.

proxyRules: { origin: string; proxyUrl?: string }[]

Usage rules for proxied requests.

When a proxy rule matches a request URL, the proxy will be chosen to perform the request instead.

Type declaration

  • Readonlyorigin: string

    An origin to match against request URLs. URLs matching this origin pattern will use the configured proxyUrl (if present) or the default proxy URL.

    Origins must contain protocol, a hostname and (optionally) a port. For example, https://subdomain.arcgis.com is a valid origin.

  • Optional ReadonlyproxyUrl?: string

    URL to a server endpoint that can act as proxy. If this URL is not specified, a default proxy will be used.

timeoutMillis: number

Default time in milliseconds after which fetch aborts with a timeout.

trustedServers: { origin: string }[]

Usages rules for trusted servers.

apprt-fetch will automatically send credentials to these servers.

Type declaration

  • Readonlyorigin: string

    An origin to match against request URLs.

    Origins must contain protocol, a hostname and (optionally) a port. For example, https://subdomain.arcgis.com is a valid origin.

Methods

  • Adds a new proxy rule to the configuration. Requests that match the rule's origin will use the specified proxyUrl.

    Note: there can only be one proxy rule for an origin.

    Parameters

    Returns void

  • Adds a new trusted server rule to the configuration. Requests that match the rule will send credentials automatically, without the need to declare it in individual requests.

    Note: there can only be one trusted server rule for an origin.

    Parameters

    Returns void

  • Registers a global interceptor. Use the handle returned by this method to deregister the interceptor when it is no longer needed.

    Parameters

    Returns Handle

  • Removes a proxy rule from the configuration.

    Parameters

    Returns void

  • Removes a trusted server rule from the configuration.

    Parameters

    Returns void