7.0.1 • Published 3 years ago
@ianwalter/http v7.0.1
@ianwalter/http
A convenience wrapper around the fetch API
Installation
yarn add @ianwalter/http
Usage
import { http } from '@ianwalter/http'
// Add a new header to the global http instance.
http.options.headers = { 'csrf-token': 'abc123' }
// Send a POST request with some data.
const response = await http.post('/api/thing', { body: { complete: true } })
Intercepting requests and responses
http.after = (url, init, response) => ({
...response,
ok: false,
status: 401,
statusText: 'Unauthorized'
})
License
Apache 2.0 with Commons Clause - See LICENSE
Created by Ian Walter
7.0.0
3 years ago
7.0.1
3 years ago
6.0.0
4 years ago
5.0.4
5 years ago
5.0.3
5 years ago
5.0.2
5 years ago
5.0.1
6 years ago
5.0.0
6 years ago
4.1.0
6 years ago
4.0.3
6 years ago
4.0.2
6 years ago
4.0.1
6 years ago
4.0.0
6 years ago
3.0.0
6 years ago
2.1.2
6 years ago
2.1.1
6 years ago
2.1.0
6 years ago
2.0.0
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago