Fetch API

02/08/2017

2 minutes to read

Contributors

In this article

The Fetch API utilizes the fetch method for fetching resources. In the past this was achieved with XMLHttpRequest. Not only is fetch simpler to use, it also provides lower level access to requests and responses.

Sets a new value to an already existing header inside a Headers object.

Request and Response

The Fetch API gives you more freedom when it comes to making requests and responses when compared to XHR. The Request object represents a resource request, while the Response object represents the response of a request.
The body of a Response object contains a stream that is read from using the Streams API.

API reference

Related topics

Specification

The feedback system for this content will be changing soon. Old comments will not be carried over. If content within a comment thread is important to you, please save a copy. For more information on the upcoming change, we invite you to read our blog post.