HttpRequest interface

Represents an HTTP request.

Properties

abortSignal

An AbortSignal that can be monitored for cancellation.

content

The body content for the request. May be a string or an ArrayBuffer (for binary data).

headers

An object describing headers to apply to the request.

method

The HTTP method to use for the request.

responseType

The XMLHttpRequestResponseType to apply to the request.

timeout

The time to wait for the request to complete before throwing a TimeoutError. Measured in milliseconds.

url

The URL for the request.

withCredentials

This controls whether credentials such as cookies are sent in cross-site requests.

Property Details

abortSignal

An AbortSignal that can be monitored for cancellation.

abortSignal?: AbortSignal

Property Value

content

The body content for the request. May be a string or an ArrayBuffer (for binary data).

content?: string | ArrayBuffer

Property Value

string | ArrayBuffer

headers

An object describing headers to apply to the request.

headers?: MessageHeaders

Property Value

method

The HTTP method to use for the request.

method?: string

Property Value

string

responseType

The XMLHttpRequestResponseType to apply to the request.

responseType?: XMLHttpRequestResponseType

Property Value

XMLHttpRequestResponseType

timeout

The time to wait for the request to complete before throwing a TimeoutError. Measured in milliseconds.

timeout?: number

Property Value

number

url

The URL for the request.

url?: string

Property Value

string

withCredentials

This controls whether credentials such as cookies are sent in cross-site requests.

withCredentials?: boolean

Property Value

boolean