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?
optionalallowAbsoluteUrls?:boolean
Defined in: api/rust-fetch.d.ts:430
Overrides the client's allowAbsoluteUrls
allowInsecureRedirects?
optionalallowInsecureRedirects?:boolean
Defined in: api/rust-fetch.d.ts:436
Overrides the client's allowInsecureRedirects
allowPrivateNetwork?
optionalallowPrivateNetwork?:boolean
Defined in: api/rust-fetch.d.ts:440
Overrides the client's allowPrivateNetwork
cache?
optionalcache?:"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
connectTimeoutMs?
optionalconnectTimeoutMs?: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?
optionalcredentials?:"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?
optionaldeadlineMs?:number
Defined in: api/rust-fetch.d.ts:412
Total logical-request deadline, including queueing, retries and reading the body. 0 disables.
dedupe?
optionaldedupe?: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?
optionalheaders?:HeadersLike
Defined in: api/rust-fetch.d.ts:401
httpCache?
optionalhttpCache?: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?
optionalidempotencyHeader?:string
Defined in: api/rust-fetch.d.ts:423
Overrides the client's idempotency header name
idempotencyKey?
optionalidempotencyKey?: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?
optionalidleTimeoutMs?:number
Defined in: api/rust-fetch.d.ts:410
Maximum wait for the next body chunk, including streams and SSE. 0 disables.
integrity?
optionalintegrity?:string
Defined in: api/rust-fetch.d.ts:83
Subresource integrity metadata, e.g. sha384-…
Inherited from
BrowserRequestOptions.integrity
keepalive?
optionalkeepalive?: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?
optionalmaxLineBytes?: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?
optionalmaxRedirects?:number
Defined in: api/rust-fetch.d.ts:428
Overrides the client's maxRedirects
maxResponseBytes?
optionalmaxResponseBytes?:number|null
Defined in: api/rust-fetch.d.ts:432
Overrides the client's maxResponseBytes; null removes the limit for this request
mode?
optionalmode?:"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
onDownloadProgress?
optionalonDownloadProgress?: (progress) =>void
Defined in: api/rust-fetch.d.ts:447
Called after each received chunk of a successful response
Parameters
progress
Returns
void
onUploadProgress?
optionalonUploadProgress?: (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
Returns
void
params?
optionalparams?:QueryParams
Defined in: api/rust-fetch.d.ts:402
priority?
optionalpriority?:"high"|"low"|"auto"
Defined in: api/rust-fetch.d.ts:78
Fetch priority, where the browser supports it
Inherited from
BrowserRequestOptions.priority
redirect?
optionalredirect?:RedirectMode
Defined in: api/rust-fetch.d.ts:426
Overrides the client's redirect
referrer?
optionalreferrer?:string
Defined in: api/rust-fetch.d.ts:80
A same-origin URL, '' for none, or about:client (default)
Inherited from
BrowserRequestOptions.referrer
referrerPolicy?
optionalreferrerPolicy?:""|"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?
optionalresponseTimeoutMs?:number
Defined in: api/rust-fetch.d.ts:408
Time until final response headers arrive. 0 disables.
responseType?
optionalresponseType?:ResponseBodyType
Defined in: api/rust-fetch.d.ts:424
resume?
optionalresume?: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?
optionalretries?: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?
optionalschema?: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?
optionalsensitiveHeaders?:string[]
Defined in: api/rust-fetch.d.ts:434
Overrides the client's sensitiveHeaders
signal?
optionalsignal?: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?
optionaltimeoutMs?:number
Defined in: api/rust-fetch.d.ts:404
Overrides the client timeout for this request, in ms. 0 disables it.