WebResource interface

A description of a HTTP request to be made to a remote server.

Properties

abortSignal

Signal of an abort controller. Can be used to abort both sending a network request and waiting for a response.

body

The HTTP body contents of the request.

decompressResponse

Whether or not to decompress response according to Accept-Encoding header (node-fetch only)

formData

Form data, used to build the request body.

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.

proxySettings

Proxy configuration.

query

A query string represented as an object.

requestId

A unique identifier for the request. Used for logging and tracing.

streamResponseBody

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

streamResponseStatusCodes

A list of response status codes whose corresponding HttpOperationResponse body 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(unknown)

This is a no-op for compat purposes and will throw if called.

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. Note: this a no-op for compat purposes.

Property Details

abortSignal

Signal of an abort controller. Can be used to abort both sending a network request and waiting for a response.

abortSignal?: AbortSignalLike

Property Value

body

The HTTP body contents of the request.

body?: any

Property Value

any

decompressResponse

Whether or not to decompress response according to Accept-Encoding header (node-fetch only)

decompressResponse?: boolean

Property Value

boolean

formData

Form data, used to build the request body.

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

proxySettings

Proxy configuration.

proxySettings?: ProxySettings

Property Value

query

A query string represented as an object.

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

Property Value

{[key: string]: any}

requestId

A unique identifier for the request. Used for logging and tracing.

requestId: string

Property Value

string

streamResponseBody

Warning

This API is now deprecated.

Use streamResponseStatusCodes property instead.

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

streamResponseBody?: boolean

Property Value

boolean

streamResponseStatusCodes

A list of response status codes whose corresponding HttpOperationResponse body should be treated as a stream.

streamResponseStatusCodes?: Set<number>

Property Value

Set<number>

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(unknown)

This is a no-op for compat purposes and will throw if called.

function prepare(options: unknown): WebResourceLike

Parameters

options

unknown

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. Note: this a no-op for compat purposes.

function validateRequestProperties()