Expand description
The WHATWG Fetch globals: fetch, Headers, Request, Response, Blob,
FormData, AbortController and AbortSignal.
fetch is not a re-implementation of an HTTP client: it drives the SAME
exchange http.request/https.request already perform (http::exchange /
https::exchange), on a background thread, and hands the parsed result back
over the host’s I/O channel — the pattern every other async native in this
frontend uses. That keeps one HTTP/1.1 wire implementation, one chunked
decoder and one TLS configuration in the process.
A body is held as raw BYTES (@@body, a JS array of byte numbers) rather
than as a string, so arrayBuffer()/bytes() are exact for a binary
response and text() decodes UTF-8 once, at the point the caller asks for
text. A Response is fully buffered by the time the promise settles, so the
body accessors are already-settled promises — the streaming body
ReadableStream is the one part of the interface this does not provide.
Constants§
- ABORT_
CONTROLLER_ METHODS - ABORT_
SIGNAL_ METHODS - ABORT_
SIGNAL_ STATICS - BLOB_
METHODS - CLASSES
- The classes this module constructs, as bare globals.
- FORM_
DATA_ METHODS - HEADERS_
METHODS - REQUEST_
METHODS - RESPONSE_
METHODS - RESPONSE_
STATICS
Functions§
- abort_
controller_ call - abort_
signal_ call - abort_
signal_ static AbortSignal.abort(reason)/AbortSignal.timeout(ms).- body_
call - The body accessors shared by
Response,RequestandBlob. Each answers a settled Promise, because the body is already fully buffered. - construct
- construct_
abort_ controller - construct_
blob - construct_
file new File(parts, name[, options])— aBlobthat also carries a name.- construct_
form_ data - construct_
headers new Headers(init).initis anotherHeaders, an array of[name, value]pairs, or a plain object.- construct_
request new Request(input, init).- construct_
response new Response(body, init).- fetch
fetch(input[, init])— a Promise for a fully bufferedResponse.- fire_
timeout_ abort - Fire an
AbortSignal.timeoutdeadline: abort the signal at heap indexidxwith aTimeoutError. Reached from the@@aborttimeout:<idx>thunk. - form_
data_ call - headers_
call - instance_
call - is_
class - methods_
for - new_
abort_ signal - static_
call - The static methods of these classes (
Response.json,AbortSignal.abort, …).