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?
optionalallowAbsoluteUrls?:boolean
Defined in: api/rust-fetch.d.ts:633
Overrides the client's allowAbsoluteUrls
body?
optionalbody?:RequestBody
Defined in: api/rust-fetch.d.ts:603
Request body, as for other requests; sent again on each reconnection
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:609
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:615
Total logical-request deadline, including queueing, retries and reading the body. 0 disables.
end?
optionalend?: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?
optionalheaders?:HeadersLike
Defined in: api/rust-fetch.d.ts:604
idempotencyHeader?
optionalidempotencyHeader?:string
Defined in: api/rust-fetch.d.ts:622
Overrides the client's idempotency header name
idempotencyKey?
optionalidempotencyKey?: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?
optionalidleTimeoutMs?:number
Defined in: api/rust-fetch.d.ts:613
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
maxEventBytes?
optionalmaxEventBytes?:number|null
Defined in: api/rust-fetch.d.ts:637
Overrides the client's maxEventBytes; null removes the limit for this stream
maxLineBytes?
optionalmaxLineBytes?:number|null
Defined in: api/rust-fetch.d.ts:635
Overrides the client's maxLineBytes; null removes the limit for this stream
messageType?
optionalmessageType?:"auto"|"json"
Defined in: api/rust-fetch.d.ts:629
auto (default): data is a string. json: data is parsed JSON
method?
optionalmethod?:string
Defined in: api/rust-fetch.d.ts:601
HTTP method. Default: GET
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
onClose?
optionalonClose?: () =>void
Defined in: api/rust-fetch.d.ts:649
Called once, when the stream is closed for good
Returns
void
onError?
optionalonError?: (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
Returns
void
onEvent?
optionalonEvent?: (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
Returns
void
onOpen?
optionalonOpen?: () =>void
Defined in: api/rust-fetch.d.ts:641
Called each time a connection opens, including after reconnecting
Returns
void
onReconnect?
optionalonReconnect?: (info) =>void
Defined in: api/rust-fetch.d.ts:647
Called before waiting to reconnect
Parameters
info
Returns
void
params?
optionalparams?:QueryParams
Defined in: api/rust-fetch.d.ts:605
priority?
optionalpriority?:"high"|"low"|"auto"
Defined in: api/rust-fetch.d.ts:78
Fetch priority, where the browser supports it
Inherited from
BrowserRequestOptions.priority
reconnect?
optionalreconnect?: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?
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:611
Time until final response headers arrive. 0 disables.
retries?
optionalretries?: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?
optionalsignal?:AbortSignal
Defined in: api/rust-fetch.d.ts:639
Closes the stream and stops reconnecting when aborted
timeoutMs?
optionaltimeoutMs?: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