Skip to content

Interface: RequestOptions ​

Defined in: api/rust-fetch.d.ts:392

fetch() options for browsers, Web Workers and other fetch() runtimes (Deno, Bun). Node.js requests don't use them; they're still validated there.

Extends ​

Extended by ​

Properties ​

allowAbsoluteUrls? ​

optional allowAbsoluteUrls?: boolean

Defined in: api/rust-fetch.d.ts:430

Overrides the client's allowAbsoluteUrls


allowInsecureRedirects? ​

optional allowInsecureRedirects?: boolean

Defined in: api/rust-fetch.d.ts:436

Overrides the client's allowInsecureRedirects


allowPrivateNetwork? ​

optional allowPrivateNetwork?: boolean

Defined in: api/rust-fetch.d.ts:440

Overrides the client's allowPrivateNetwork


cache? ​

optional cache?: "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached"

Defined in: api/rust-fetch.d.ts:74

How the browser's HTTP cache is used

Inherited from ​

BrowserRequestOptions.cache


connectTimeoutMs? ​

optional connectTimeoutMs?: number

Defined in: api/rust-fetch.d.ts:406

Time until a connection is established, including TLS (Node.js); browsers cannot observe it. 0 disables.


credentials? ​

optional credentials?: "omit" | "same-origin" | "include"

Defined in: api/rust-fetch.d.ts:70

Send cookies and HTTP authentication: same-origin (default), include (also cross-origin) or omit

Inherited from ​

BrowserRequestOptions.credentials


deadlineMs? ​

optional deadlineMs?: number

Defined in: api/rust-fetch.d.ts:412

Total logical-request deadline, including queueing, retries and reading the body. 0 disables.


dedupe? ​

optional dedupe?: boolean

Defined in: api/rust-fetch.d.ts:398

get and head only: share one request and response with identical requests in flight at once (same URL, headers and options), or false to opt out when the client's dedupe is on. Each caller gets its own response object. Not with streamed responseTypes.


headers? ​

optional headers?: HeadersLike

Defined in: api/rust-fetch.d.ts:401


httpCache? ​

optional httpCache?: boolean

Defined in: api/rust-fetch.d.ts:396

false skips the client's httpCache for this request: nothing is served from it or stored in it.


idempotencyHeader? ​

optional idempotencyHeader?: string

Defined in: api/rust-fetch.d.ts:423

Overrides the client's idempotency header name


idempotencyKey? ​

optional idempotencyKey?: string | boolean

Defined in: api/rust-fetch.d.ts:421

Overrides the client's key policy. true generates a key for this call; false disables it. Requires server deduplication.


idleTimeoutMs? ​

optional idleTimeoutMs?: number

Defined in: api/rust-fetch.d.ts:410

Maximum wait for the next body chunk, including streams and SSE. 0 disables.


integrity? ​

optional integrity?: string

Defined in: api/rust-fetch.d.ts:83

Subresource integrity metadata, e.g. sha384-…

Inherited from ​

BrowserRequestOptions.integrity


keepalive? ​

optional keepalive?: boolean

Defined in: api/rust-fetch.d.ts:76

Let the request outlive the page, e.g. for analytics on unload (bodies up to 64 KB)

Inherited from ​

BrowserRequestOptions.keepalive


maxLineBytes? ​

optional maxLineBytes?: number | null

Defined in: api/rust-fetch.d.ts:438

responseType: 'ndjson': overrides the client's maxLineBytes; null removes the limit for this request


maxRedirects? ​

optional maxRedirects?: number

Defined in: api/rust-fetch.d.ts:428

Overrides the client's maxRedirects


maxResponseBytes? ​

optional maxResponseBytes?: number | null

Defined in: api/rust-fetch.d.ts:432

Overrides the client's maxResponseBytes; null removes the limit for this request


mode? ​

optional mode?: "same-origin" | "cors" | "no-cors"

Defined in: api/rust-fetch.d.ts:72

cors (default), same-origin, or no-cors, which resolves with an opaque response (status: 0, no headers, no body)

Inherited from ​

BrowserRequestOptions.mode


onDownloadProgress? ​

optional onDownloadProgress?: (progress) => void

Defined in: api/rust-fetch.d.ts:447

Called after each received chunk of a successful response

Parameters ​

progress ​

DownloadProgress

Returns ​

void


onUploadProgress? ​

optional onUploadProgress?: (progress) => void

Defined in: api/rust-fetch.d.ts:453

Called as the request body is sent; starts again from 0 if the request is retried. Browsers send these requests with XMLHttpRequest (cross-origin ones are preflighted). Can't be combined with responseType: 'stream'.

Parameters ​

progress ​

UploadProgress

Returns ​

void


params? ​

optional params?: QueryParams

Defined in: api/rust-fetch.d.ts:402


priority? ​

optional priority?: "high" | "low" | "auto"

Defined in: api/rust-fetch.d.ts:78

Fetch priority, where the browser supports it

Inherited from ​

BrowserRequestOptions.priority


redirect? ​

optional redirect?: RedirectMode

Defined in: api/rust-fetch.d.ts:426

Overrides the client's redirect


referrer? ​

optional referrer?: string

Defined in: api/rust-fetch.d.ts:80

A same-origin URL, '' for none, or about:client (default)

Inherited from ​

BrowserRequestOptions.referrer


referrerPolicy? ​

optional referrerPolicy?: "" | "origin" | "same-origin" | "no-referrer" | "no-referrer-when-downgrade" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url"

Defined in: api/rust-fetch.d.ts:81

Inherited from ​

BrowserRequestOptions.referrerPolicy


responseTimeoutMs? ​

optional responseTimeoutMs?: number

Defined in: api/rust-fetch.d.ts:408

Time until final response headers arrive. 0 disables.


responseType? ​

optional responseType?: ResponseBodyType

Defined in: api/rust-fetch.d.ts:424


resume? ​

optional resume?: boolean | { maxResumes?: number; }

Defined in: api/rust-fetch.d.ts:394

get with responseType: 'stream' only: when the connection breaks mid-body, continue with a Range request (checked with If-Range) instead of failing, up to maxResumes times (default 3). Needs a server that sends Accept-Ranges: bytes, an ETag or Last-Modified, and no Content-Encoding; otherwise the stream fails as usual. response.resumes counts the continuations.


retries? ​

optional retries?: number | RetryOptions

Defined in: api/rust-fetch.d.ts:419

Replaces the client's retry policy for this request (also for events() connection attempts). 0 disables retries. Omitted object fields use the standard defaults, not the client's values. The client's shared retryBudget still applies. Separate from events()'s reconnect.


schema? ​

optional schema?: StandardSchema<unknown>

Defined in: api/rust-fetch.d.ts:400

Validate the response body with a Standard Schema (Zod, Valibot, ArkType…). The body of the response becomes the schema's output; a body that fails rejects with a ValidationError (not retried). Not with responseType: 'stream' or 'ndjson'.


sensitiveHeaders? ​

optional sensitiveHeaders?: string[]

Defined in: api/rust-fetch.d.ts:434

Overrides the client's sensitiveHeaders


signal? ​

optional signal?: AbortSignal

Defined in: api/rust-fetch.d.ts:445

Cancels the request (including pending retries) when aborted; rejects with a CancelledError. For responseType: 'stream' it also errors the body stream.


timeoutMs? ​

optional timeoutMs?: number

Defined in: api/rust-fetch.d.ts:404

Overrides the client timeout for this request, in ms. 0 disables it.

Released under the MIT or Apache-2.0 license.