Skip to content

Interface: EventStreamOptions ​

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

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 ​

Properties ​

allowAbsoluteUrls? ​

optional allowAbsoluteUrls?: boolean

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

Overrides the client's allowAbsoluteUrls


body? ​

optional body?: RequestBody

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

Request body, as for other requests; sent again on each reconnection


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:609

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:615

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


end? ​

optional end?: string | null

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

Close the stream normally when an event's raw data equals this. Default: '[DONE]' with messageType: 'json', otherwise none


headers? ​

optional headers?: HeadersLike

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


idempotencyHeader? ​

optional idempotencyHeader?: string

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

Overrides the client's idempotency header name


idempotencyKey? ​

optional idempotencyKey?: string | boolean

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

Overrides the client's key policy; generated keys are reused across retries and reconnections. Requires server deduplication.


idleTimeoutMs? ​

optional idleTimeoutMs?: number

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

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


maxEventBytes? ​

optional maxEventBytes?: number | null

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

Overrides the client's maxEventBytes; null removes the limit for this stream


maxLineBytes? ​

optional maxLineBytes?: number | null

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

Overrides the client's maxLineBytes; null removes the limit for this stream


messageType? ​

optional messageType?: "auto" | "json"

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

auto (default): data is a string. json: data is parsed JSON


method? ​

optional method?: string

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

HTTP method. Default: GET


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


onClose? ​

optional onClose?: () => void

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

Called once, when the stream is closed for good

Returns ​

void


onError? ​

optional onError?: (error) => void

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

Called on every failure: a failed attempt, a dropped stream, a data that isn't JSON

Parameters ​

error ​

RustFetchError

Returns ​

void


onEvent? ​

optional onEvent?: (event) => void

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

Called for each event. Without it, events are buffered for for await … of stream

Parameters ​

event ​

ServerSentEvent

Returns ​

void


onOpen? ​

optional onOpen?: () => void

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

Called each time a connection opens, including after reconnecting

Returns ​

void


onReconnect? ​

optional onReconnect?: (info) => void

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

Called before waiting to reconnect

Parameters ​

info ​

WebSocketReconnectInfo

Returns ​

void


params? ​

optional params?: QueryParams

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


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


reconnect? ​

optional reconnect?: number | boolean | ReconnectOptions

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

Reconnect after the stream ends or a connection fails, sending Last-Event-ID and honouring the server's retry: field. Default: on for GET, off for other methods (which would resend the body).


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:611

Time until final response headers arrive. 0 disables.


retries? ​

optional retries?: number | RetryOptions

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

Replaces the client's retry policy for each connection attempt; 0 disables retries. Omitted fields use standard defaults. Separate from reconnect.


signal? ​

optional signal?: AbortSignal

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

Closes the stream and stops reconnecting when aborted


timeoutMs? ​

optional timeoutMs?: number

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

Time allowed for each connection attempt until the response headers arrive, in ms. Default: the client's timeoutMs

Released under the MIT or Apache-2.0 license.