# WHATWG Fetch

> The fetch function and its Blob, File, Headers, FormData, Request, and Response globals.

`fetch`, `Blob`, `File`, `Headers`, `FormData`, `Request`, and `Response` are globals and follow the
[Fetch Standard](https://fetch.spec.whatwg.org/).

## Differences from browsers

- Requests send `User-Agent: Elide/<version>` and `Accept: */*` unless you set those headers.
- `ELIDE_HTTP_USER_AGENT` sets the default user agent; a per-request header overrides it. Values must be printable
  ASCII.
- Gzip, deflate, Brotli, and Zstandard responses are decoded; response headers still describe the encoded body.
- An explicit `Accept-Encoding` header is sent as given; range requests default to `identity`.
- `fetch(url, { decompress: false })` sends `Accept-Encoding: identity` and returns any encoded body unchanged.
- A malformed compressed body rejects.
- There is no HTTP cache: conditional headers are sent as given, and a `304` has headers and no body.
- `Headers` applies the request, response, no-CORS and immutable guards; iteration lowercases and sorts names and
  keeps `Set-Cookie` values separate.
- Integrity checks buffer up to 100 MiB before the response resolves.
- HTTP/1.1, HTTP/2, and HTTP proxies (including HTTPS `CONNECT`) work; authenticated proxies fail.
- Certificates and hostnames are validated; for trust settings, see
  [Runtime Environment Variables](https://elide.help/docs/runtime-env-variables).

To serve HTTP, see [`Elide.serve`](https://elide.help/docs/api-globals-elide) or [node:http](https://elide.help/docs/api-node-http).
