Elide exposes Blob, File, Headers, FormData, Request,
Response, and fetch as globals.
Blob and File
const blob = new Blob(["hello"]);
await blob.text(); // "hello"
await blob.bytes(); // Uint8Array(5)
const file = new File(["hello"], "greeting.txt", {
type: "text/plain",
lastModified: 1700000000000,
});
file instanceof Blob; // trueBlob readers include text(), arrayBuffer(), bytes(), and
stream(). slice() returns a Blob. File adds name and
lastModified.
Headers
const headers = new Headers([["X-Custom", "1"]]);
headers.append("X-Custom", "2");
headers.get("x-custom"); // "1, 2"
headers.append("Set-Cookie", "a=1");
headers.getSetCookie(); // ["a=1"]Names are case-insensitive. Iteration lowercases and sorts names, combines most
duplicate values, and keeps Set-Cookie values separate. Invalid names or
values throw TypeError. Request, response, no-CORS, and immutable guards
restrict mutations where applicable.
FormData
FormData is an insertion-ordered list of string or File values.
const form = new FormData();
form.append("tag", "first");
form.append("tag", "second");
form.getAll("tag"); // ["first", "second"]
form.append("upload", new Blob(["hello"], { type: "text/plain" }));
form.get("upload").name; // "blob"A Blob is normalized to a File when appended. set() replaces the first
matching entry and removes later duplicates.
Request and Response bodies
Both classes expose body, bodyUsed, arrayBuffer(), blob(),
bytes(), formData(), json(), and text().
Supported body inputs include strings, blobs, buffer sources, FormData,
URLSearchParams, and ReadableStream. GET and HEAD requests reject a non-null
body. A stream request body requires duplex: "half".
const request = new Request("https://example.invalid/", {
method: "POST",
body: "hello",
});
await request.text(); // "hello"
const response = Response.json({ ok: true });
await response.json(); // { ok: true }Request URLs must be absolute. Response constructor statuses are limited to
200–599. Response.redirect() also requires an absolute URL.
Response.error(), Response.redirect(), Response.json(), and
clone() are available.
fetch
fetch(input, init?) accepts a URL, URL string, or Request and returns a
Promise that resolves when response headers arrive. The response body is a
ReadableStream: chunks become available before the server finishes sending the
response. Methods such as response.text() consume the stream to completion.
Request bodies can also be streams. Cancelling a response body closes its network
stream; an AbortSignal can cancel dispatch or subsequent body reads. Redirect
modes and integrity metadata are applied during dispatch. Integrity verification
buffers up to 100 MiB and completes before exposing the response.
Gzip and deflate responses are decoded once while retaining their response headers. HTTPS validates certificate chains and hostnames by default; additional trust configuration is listed in Runtime Environment Variables.
Native Image builds select Netty for HTTP/1.1 and HTTP/2; JVM mode retains the JDK
backend. Use elide info to inspect the selected socket transport, TLS provider,
and available linkage evidence. HTTP proxies selected by the host’s
ProxySelector are supported, including HTTPS CONNECT. Authenticated proxies and
unsupported proxy types fail explicitly.
Compression is documented separately in Compression Streams. HTTP server options and lifecycle belong to the Elide global reference.