bindings/fetch library
Fetch Standard
Classes
- Body
- Headers
-
The interface of the Fetch API allows you to perform various
actions on HTTP request and response headers. These actions
include retrieving, setting, adding to, and removing headers from
the list of the request's headers.
A object has an associated header list, which is initially empty
and consists of zero or more name and value pairs. You can add to
this using methods like
append()
(see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. For security reasons, some headers can only be controlled by the user agent. These headers include the forbidden header names and forbidden response header names. A Headers object also has an associated guard, which takes a value ofimmutable
,request
,request-no-cors
,response
, ornone
. This affects whether theset()
, delete(), andappend()
methods will mutate the header. For more information see Guard. You can retrieve a object via theRequest.headers
andResponse.headers
properties, and create a new object using the Headers.Headers() constructor. An object implementing can directly be used in afor...of
structure, instead ofentries()
:for (var p of myHeaders)
is equivalent tofor (var p of myHeaders.entries())
. - Request
-
The interface of the Fetch API represents a resource request.
You can create a new object using the Request() constructor,
but you are more likely to encounter a object being returned as
the result of another API operation, such as a service worker
FetchEvent.request
. - RequestInit
- Response
-
The interface of the Fetch API represents the response to a
request.
You can create a new object using the Response.Response()
constructor, but you are more likely to encounter a object being
returned as the result of another API operation—for example, a
service worker
FetchEvent.respondWith
, or a simplefetch()
. - ResponseInit