Top "Fetch-api" questions

The Fetch API is an improved replacement for XHR, for making asynchronous HTTP requests while better managing redirects and interaction with CORS and Service Workers.

How to use FormData in react-native?

Hi just learn to use js and react-native. I cant use FormData it always shows unsupported bodyinit type. I want …

javascript react-native fetch-api
Fetch: reject promise and catch the error if status is not OK?

Here's what I have going: import 'whatwg-fetch'; function fetchVehicle(id) { return dispatch => { return dispatch({ type: 'FETCH_VEHICLE', payload: fetch(`…

javascript redux fetch-api
How do I cancel an HTTP fetch() request?

There is a new API for making requests from JavaScript: fetch(). Is there any built in mechanism for canceling these …

javascript ajax fetch-api
How can I download a file using window.fetch?

If I want to download a file, what should I do in the then block below? function downloadFile(token, fileId) { …

javascript fetch fetch-api
Unable to fetch POST without no-cors in header

On making request like that: return fetch( 'http://localhost:8000/login', { method: 'POST', headers: new Headers( {"Content-Type": "application/json", "Accept":"application/…

javascript cors fetch-api
How to POST with multipart/form-data header and FormData using fetch

This is a CURL example which works fine: curl -X POST \ <url> \ -H 'authorization: Bearer <token>…

node.js curl fetch-api http-content-length isomorphic-fetch-api
POST Request with Fetch API?

I know that with the new Fetch API (used here with ES2017's async/await) you can make a GET …

javascript fetch-api
javascript fetch - Failed to execute 'json' on 'Response': body stream is locked

When the request status is greater than 400(I have tried 400, 423, 429 states), fetch cannot read the returned json content. The following …

javascript fetch-api
fetch() unexpected end of input

I am using fetch() to grab data from api server. My error looks like this: Uncaught (in promise) SyntaxError: Unexpected …

javascript json cors fetch-api
How to set the content-type of request header when using Fetch APi

I am using npm 'isomorphic-fetch' to send requests. The problem I am experiencing is I am unable to set the …

node.js request-headers fetch-api nodeapi isomorphic-fetch-api