WebResourceLike interface

An abstraction over a REST call.

Properties

abortSignal

Used to abort the request later.

agentSettings

HTTP(S) agent configuration.

body

The HTTP body contents of the request.

formData
headers

The HTTP headers to use when making the request.

keepAlive

If the connection should be reused.

method

The HTTP method to use when making the request.

onDownloadProgress

Callback which fires upon download progress.

onUploadProgress

Callback which fires upon upload progress.

operationResponseGetter

A function that returns the proper OperationResponse for the given OperationSpec and HttpOperationResponse combination. If this is undefined, then a simple status code lookup will be used.

operationSpec

Used to parse the response.

proxySettings

Proxy configuration.

query

A query string represented as an object.

redirectLimit

Limit the number of redirects followed for this request. If set to 0, redirects will not be followed. If left undefined the default redirect behaviour of the underlying node_fetch will apply.

shouldDeserialize

Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the HttpOperationResponse should be deserialized.

streamResponseBody

Whether or not the body of the HttpOperationResponse should be treated as a stream.

timeout

The number of milliseconds a request can take before automatically being terminated. If the request is terminated, an AbortError is thrown.

url

The URL being accessed by the request.

withCredentials

If credentials (cookies) should be sent along during an XHR.

Methods

clone()

Clone this request object.

prepare(RequestPrepareOptions)

Sets options on the request.

validateRequestProperties()

Validates that the required properties such as method, url, headers["Content-Type"], headers["accept-language"] are defined. It will throw an error if one of the above mentioned properties are not defined.

Property Details

abortSignal

Used to abort the request later.

abortSignal?: AbortSignalLike

Property Value

agentSettings

HTTP(S) agent configuration.

agentSettings?: AgentSettings

Property Value

body

The HTTP body contents of the request.

body?: any

Property Value

any

formData

formData?: any

Property Value

any

headers

The HTTP headers to use when making the request.

headers: HttpHeadersLike

Property Value

keepAlive

If the connection should be reused.

keepAlive?: boolean

Property Value

boolean

method

The HTTP method to use when making the request.

method: HttpMethods

Property Value

onDownloadProgress

Callback which fires upon download progress.

onDownloadProgress?: (progress: TransferProgressEvent) => void

Property Value

(progress: TransferProgressEvent) => void

onUploadProgress

Callback which fires upon upload progress.

onUploadProgress?: (progress: TransferProgressEvent) => void

Property Value

(progress: TransferProgressEvent) => void

operationResponseGetter

A function that returns the proper OperationResponse for the given OperationSpec and HttpOperationResponse combination. If this is undefined, then a simple status code lookup will be used.

operationResponseGetter?: (operationSpec: OperationSpec, response: HttpOperationResponse) => undefined | OperationResponse

Property Value

(operationSpec: OperationSpec, response: HttpOperationResponse) => undefined | OperationResponse

operationSpec

Used to parse the response.

operationSpec?: OperationSpec

Property Value

proxySettings

Proxy configuration.

proxySettings?: ProxySettings

Property Value

query

A query string represented as an object.

query?: {[key: string]: any}

Property Value

{[key: string]: any}

redirectLimit

Limit the number of redirects followed for this request. If set to 0, redirects will not be followed. If left undefined the default redirect behaviour of the underlying node_fetch will apply.

redirectLimit?: number

Property Value

number

shouldDeserialize

Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the HttpOperationResponse should be deserialized.

shouldDeserialize?: boolean | (response: HttpOperationResponse) => boolean

Property Value

boolean | (response: HttpOperationResponse) => boolean

streamResponseBody

Whether or not the body of the HttpOperationResponse should be treated as a stream.

streamResponseBody?: boolean

Property Value

boolean

timeout

The number of milliseconds a request can take before automatically being terminated. If the request is terminated, an AbortError is thrown.

timeout: number

Property Value

number

url

The URL being accessed by the request.

url: string

Property Value

string

withCredentials

If credentials (cookies) should be sent along during an XHR.

withCredentials: boolean

Property Value

boolean

Method Details

clone()

Clone this request object.

function clone(): WebResourceLike

Returns

prepare(RequestPrepareOptions)

Sets options on the request.

function prepare(options: RequestPrepareOptions): WebResourceLike

Parameters

Returns

validateRequestProperties()

Validates that the required properties such as method, url, headers["Content-Type"], headers["accept-language"] are defined. It will throw an error if one of the above mentioned properties are not defined.

function validateRequestProperties()