Options for configuring requests to NGW.

interface RequestOptions<M, K> {
    cache?: boolean;
    cacheName?: string;
    cacheProps?: Record<string, unknown>;
    data?: any;
    file?: File;
    headers?: RequestHeaders;
    method?: M;
    onProgress?: ((percentComplete: number, event: ProgressEvent<EventTarget>) => void);
    params?: RequestItemsParams<K>;
    responseType?: "json" | "blob";
    signal?: null | AbortSignal;
    withCredentials?: boolean;
}

Type Parameters

Hierarchy (view full)

Properties

cache?: boolean

Whether to cache the request. When set to true, the response will be stored in the cache.

cacheName?: string

Name to use for caching the request.

cacheProps?: Record<string, unknown>

Properties to override default cache behavior.

data?: any

Data to be sent as the request body. Typically used with POST, PUT, or PATCH requests.

file?: File

File to be sent in the request.

headers?: RequestHeaders

HTTP headers to be included in the request.

method?: M

HTTP method to be used for the request. Example: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'

onProgress?: ((percentComplete: number, event: ProgressEvent<EventTarget>) => void)

A function to be called to monitor the progress of the request.

Type declaration

    • (percentComplete, event): void
    • Parameters

      • percentComplete: number

        The percentage of the request that has been completed.

      • event: ProgressEvent<EventTarget>

        The progress event.

      Returns void

Parameters to be included in the request URL.

responseType?: "json" | "blob"

The type of data that the server will respond with. Can be either 'json' or 'blob'.

signal?: null | AbortSignal

Signal object that allows you to communicate with a DOM request (such as fetch) and abort it if desired via an AbortController.

withCredentials?: boolean

Indicates whether to include credentials such as cookies, authentication headers, or TLS client certificates in cross-site Access-Control requests.