Skip to main content

Module widget_net

Module widget_net 

Source
Expand description

net.fetch for sandboxed widgets (docs/specs/SPEC_USER_WIDGETS_AND_WIDGET_API_2026_10_09.md §6.3).

srv makes the request, not the widget: no cookies, no proxy, no browser profile, no AgentMux origin. The URL’s origin must match one of the package’s net: grants, and so must every redirect. The host’s addresses are resolved once and the connection is pinned to them, so a name can’t resolve to one address for the check and another for the request. A private or local address is reachable only through a grant that names it as an IP address, or localhost for loopback, port included.

Structs§

FetchRequest
FetchResponse
Grant 🔒
One net: grant, parsed.

Constants§

CREDENTIAL_HEADERS 🔒
Headers dropped when a redirect leaves the origin they were sent to.
DEFAULT_TIMEOUT 🔒
DNS_TIMEOUT 🔒
MAX_REDIRECTS 🔒
MAX_REQUEST_BYTES
MAX_RESPONSE_BYTES
MAX_TIMEOUT 🔒
REFUSED_HEADERS 🔒
Request headers a widget can’t set: srv sets them, or they’d change how the connection itself behaves.

Functions§

fetch
Makes the request for a package granted granted.
grant_for 🔒
The grant among granted that covers url, if any.
is_text 🔒
needed 🔒
The permission a request to url needs, named the way the manifest writes it (for the error).
parse_grant 🔒
read 🔒
resolve 🔒
The host’s addresses, looked up within deadline (the request’s own timeout covers DNS too), each checked against grant.
url_host 🔒