Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a single rule in a proxy instance. A Proxy rule looks like a normal Request object with an additional property match that specifies the property values on a Request instance that must match in order for the rule to be applied.

Hierarchy

Index

Properties

adapter?: string

The adapter to use to complete the request.

default

'default'

base?: string

Used in conjunction with ProxyRules to determine the domain name for the resulting Request URL. If an empty string is provided then a relative URL (one without a protocol or domain name) will be created using the existing domain name and protocol.

body?: any

An optional payload to send to the URL, set when calling createRequest().

default

null

headers?: Record<string, string | string[]>

The HTTP headers to use on the request.

default

{ accept: 'application/json, text/plain, ⁎/⁎' }

host?: string

'myapps.myserver.com', 'localhost', etc.

ignore?: Record<string, boolean>

Can be used to skip certain behaviors. See documentation for details.

match?: Record<string, string>

One or more keys in a request object whose values must match the given regular expression patterns.E.g.: {base: 'cdn'} or{base: 'myapp', path: 'load.+'}

method?: string

The HTTP verb to use.

default

'GET'

origin?: string

Can be used to specify the protocol, host name, and port number in one setting, rather than 3 different settings.

path?: string

Combined with the base path (if provided) to construct an absolute or relative URL.

port?: number

80, 8080, etc.

default

80

protocol?: string

'http', 'https', 'file', etc.

responseType?: XMLHttpRequestResponseType

The desired response type. Can be one of '' (the default), 'text', 'json', 'arraybuffer', 'blob' or 'document'. See the XHR spec for more information. Setting this will change the Response.data type.

timeout?: number

The number of milliseconds to wait before aborting the data call.

default

0 - no timeout

url?: string

The URL to open, constructed using Proxy.url() and any ProxyRules that match the given Request properties as well as any optional parameters passed to createRequest().

withCredentials?: boolean

Whether to send Cookies with the request.

default

false