Skip to content

Commit

Permalink
misc: Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Dec 19, 2018
1 parent 27d8ed7 commit b0419c5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ const fetch = require('chainfetch');
const res = await fetch.post('https://example.com').query({ isSimple: true }).query('isAmazing', true).send({ string: 'chainfetch is simple and amazing!' });
```

## Are you a TypeScript user

We got you covered! We have rich typings which should work in all cases (if not, feel free to submit an issue ❤️)

```ts
import chainfetch from 'chainfetch';
// Or
import { get } from 'chainfetch';
// Or
import * as chainfetch from 'chainfetch';

// Works
chainfetch.get();

// If you want to create your own custom class for custom handling
const myCustomClass = new chainfetch('HTTP METHOD', 'URL');
myCustomClass.get();
```

## Meaning of `toJSON`, `toText` and `toBuffer`

In chainfetch, there are 4 functions which can determine how the response should be parsed. You can access the body by using `res.body`.
Expand Down

0 comments on commit b0419c5

Please sign in to comment.