The most bytes the body may hold, counted as they arrive and again after a gzip, deflate or br coding is decoded.
How long the whole read may take in milliseconds: the host rule, the lookups, every redirect and the body.
Optional maxThe most redirects followed, each checked as the first address is.
3
Optional acceptMedia types read, without parameters, in lower case. An answer with no
Content-Type counts as application/octet-stream.
['text/html', 'application/xhtml+xml', 'application/pdf', 'text/plain']
Optional allowPorts read.
[80, 443]
Optional allowA rule over the host, asked about the host of the address and about the
host of every redirect's target, after the scheme and credential checks
and before the port check and the lookup: the read is refused with the
reason 'host' unless it answers true, so a refused host is never
resolved or connected to. It sees the host alone, as the URL parser
writes it: lower case, without a port, without the brackets around an
IPv6 address, without a trailing dot. An international name comes in its
ASCII form (bücher.example as xn--bcher-kva.example), an IPv4
address in dotted decimal however the address wrote it, an IPv4-mapped
IPv6 address and one under the well-known NAT64 prefix 64:ff9b::/96
(RFC 6052) included, since a connection to either goes to the IPv4
address it carries, through a NAT64 gateway for the second
(0x5db8d70e, [::ffff:93.184.215.14] and [64:ff9b::93.184.215.14]
as 93.184.215.14), and any other IPv6 address in compressed hex
([2606:4700:4700:0:0:0:0:1111] as 2606:4700:4700::1111). A
subdomain is a host of its own, so a rule for a site and its subdomains
compares on a dot boundary:
host === 'example.com' || host.endsWith('.example.com'), since
notexample.com also ends with example.com. The rule judges the host
the address names, before any lookup. A name is not resolved for it, so
a rule that refuses an address does not refuse a name that resolves to
that address. The rule never reads the NAT64 prefixes the fetch learns
from the resolver (RFC 7050), at the first address or at a redirect, so
an address under a prefix of the network's own comes in hex, and a rule
that refuses an IPv4 address does not refuse it under such a prefix
either. A 6to4 address (2002::/16, RFC 3056) comes in hex too. The
IPv4 address it carries is the address of the 6to4 router of a site,
and the connection ends at a host of that site, so a rule that refuses
that IPv4 address does not refuse the site's hosts, and one that allows
it does not allow them. The address check judges every address a host
resolves to by its own range, and an IPv4-mapped address, one under the
well-known NAT64 prefix or a 6to4 one by the IPv4 address it carries. A
prefix the resolver reveals only adds refusals: an address under one is
refused when the IPv4 address it carries is not public, and an address
its own range refuses, such as one under the local-use prefix
64:ff9b:1::/48 (RFC 8215), stays refused whatever it carries. A host
the rule allows is still resolved and checked as every host is: the rule
narrows what the fetch reads and never widens it. A rule that
throws refuses as one that answers false, with what it threw as the
refusal's cause; a value that is not a function is a TypeError
before any lookup. The rule is asked under the deadline and the caller's
signal like every other step: its time counts against deadlineMs, so a
rule that outlasts the deadline leaves the read refused 'deadline' with
nothing more begun, and when it aborts the signal the read ends with that
signal's reason.
every host
Optional userThe User-Agent header; none is sent when absent.
Optional signalEnds the read early; the fetch then rejects with the signal's reason.
Optional resolveAnswers a host's addresses; a test passes a stand-in.
dns.lookup with every address
Optional allowAddresses reachable though not public, for a test's own server. Never set it in production.
What the caller allows a guardedFetch.