Request options

interface RequestOptions {
    data?: string | Record<string, any>;
    handleAs?: "json" | "javascript" | "text" | "xml" | "blob" | "binary";
    headers?: Record<string, any>;
    jsonp?: string | boolean;
    jsonpfn?: string;
    maxUrlLength?: number;
    method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD";
    postprocessors?: PostProcessor[];
    preprocessors?: PreProcessor[];
    preventCache?: boolean;
    query?: Record<string, any>;
    signal?: AbortSignal;
    timeout?: number;
    useCors?: { withCredentials?: boolean };
    useProxy?: boolean | "force";
    withCredentials?: boolean;
    [key: string]: any;
}

Indexable

  • [key: string]: any

    Processors may allow additional properties

Properties

data?: string | Record<string, any>

Request body (used if POST/PUT)

handleAs?: "json" | "javascript" | "text" | "xml" | "blob" | "binary"

How to interpret the response. Default is "json".

headers?: Record<string, any>

HTTP Headers.

jsonp?: string | boolean

Enables jsonp request processing (response is interpreted as javascript). If true it appends query parameter 'callback='. If it is a string then <jsonp value>=<methodname> will be appended. Please use CORS, this will not be supported in future versions.

jsonpfn?: string

Allows 'static' jsonp. If jsonp is true and jsonpfn is configured the the query parameter 'callback=' is appended. The javascript method name is controlled by the caller and not dynamically created.

maxUrlLength?: number

Allows per request configuration of maximal url length. If it is to long a GET request will be switched to POST. Please prefer the config option 'maxUrlLength'.

method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD"

HTTP METHOD If not specified GET is used.

postprocessors?: PostProcessor[]

Custom post-processors only valid for the current request. Helpful in tests. Please prefer the config option to register processors for all requests.

preprocessors?: PreProcessor[]

Custom pre-processors only valid for the current request. Helpful in tests. Please prefer the config option to register processors for all requests.

preventCache?: boolean

Flag will create random 'salt' to the query parameters to prevent browser caching.

query?: Record<string, any>

Query Parameter. Note, if data is not defined and method is post this will be converted to the post body.

signal?: AbortSignal

AbortSignal to cancel the request.

timeout?: number

Request timeout in msec.

useCors?: { withCredentials?: boolean }

Option to mark target url as trusted for CORS. Please prefer to register a trusted servers via config.

useProxy?: boolean | "force"

Enables/disables the use of a proxy. True is the default value and a proxy is used if the CORS communication, fails. False prevents the use of a proxy. "force" skips the CORS detection and enforces the use of a proxy. Please prefer the config option 'proxyRules' for that.

withCredentials?: boolean

Option to mark request to include credentials. Please prefer to register a trusted servers via config.