@ezraobiwale/http
v2.0.3
Published
A wrapper around axios
Downloads
6
Readme
Http
A wrapper around axios
Installation
yarn add @ezraobiwale/http
or
<script src="https://cdn.jsdelivr.net/npm/@ezraobiwale/[email protected]/dist/http.js"></script>
Usage
- In node js app:
const Http = require('@ezraobiwale/http')
const http = new Http()
- In browser app:
const http = new window.Http()
Features
Supports all features of axios, with a few additional methods:
beforeResponse(fn)
: Accepts a function to call on all responses before resolving. The response can be tweaked here.setHeader(key, value)
: Sets a header for all requestsremoveHeader(key)
: Removes a previously header from all requestssetGlobalCatch(fn)
: Accepts a function to process all request errorsskipGlobalCatch()
: Indicates that the global catch should not apply to the next request.