1 | http-call
|
2 | =========
|
3 |
|
4 | [![Greenkeeper badge](https://badges.greenkeeper.io/heroku/http-call.svg)](https://greenkeeper.io/)
|
5 |
|
6 | Usage
|
7 | -----
|
8 |
|
9 | ```js
|
10 | const {HTTP} = require('http-call')
|
11 | const {body: user} = await HTTP.get('https://api.github.com/users/me')
|
12 | // do something with user
|
13 | // automatically converts from json
|
14 |
|
15 | // for typescript specify the type of the body with a generic:
|
16 | const {body: user} = await HTTP.get<{id: string, email: string}>('https://api.github.com/users/me')
|
17 |
|
18 | // set headers
|
19 | await HTTP.get('https://api.github.com', {headers: {authorization: 'bearer auth'}})
|
20 | ```
|