1.1.1 • Published 5 years ago
@thorbens/axios-fetcher v1.1.1
Axios Fetcher
Description
This package implements a fetcher using the axios library.
Use
const fetcher = new AxiosFetcher();
const response = await fetcher.fetch("http://google.com");
const body = response.body; // contains the raw response body
Post example:
const fetcher = new AxiosFetcher();
const options: FetchOptions = {
data: {
foo: `bar`,
},
method: Method.POST,
};
const response = await fetcher.fetch("https://httpbin.org/post", options);
const json = response.asJSON<MyResponseObject>(); // contains the data returned as json object