@jkempema/fetch
v1.0.4
Published
fetch function that allows middleware.
Downloads
6
Readme
fetch
fetch function that allows middleware.
Usage
import fetch from 'fetch';
fetch.applyMiddleware(
( request ) => {
request.headers.append( 'authorization', 'bearer ...' );
},
async ( request, response ) => {
const data = await response.clone().json();
},s
( request, error ) => {
console.error( error );
}
);
const response = await fetch( 'http://...', { method: "GET" } );
const data = await response.json();