Skip to content

Commit

Permalink
update changelog and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jd1378 committed Mar 27, 2021
1 parent 7d8c360 commit 88480ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Changelog

## v4.0.0

- due to adding `timeout` option and the way it works, it may cause issues. so I release this as breaking change.

## v3.0.1

- fix `form` keys not getting url encoded.
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# deno-fetch-goody

This library offers a fetch wrapper that automatically adds `Content-Type` header. also it can accepts object as body now to send as json.
This library offers a fetch wrapper that can:

Also adds `Accept` header with value `application/json, text/plain, */*` if not already set by you.
- automatically add `Content-Type` header
- directly use objects for `body` as json (see below)
- send `form`, `formData`, `qs` (query string) easily from objects
- set a validator globally or per request, to reject when validator throws.
- accept a timeout option and reject on timeout (currently how it works leaks resources due to [AbortController](https://github.com/denoland/deno/issues/7019) not being supported yet)
- add `Accept` header with value `application/json, text/plain, */*` if not already set by you

## usage

you can import `wrapFetch` from `mod.ts` file.

```js
export { wrapFetch } from 'https://deno.land/x/fetch_goody@v3.0.1/mod.ts';
export { wrapFetch } from 'https://deno.land/x/fetch_goody@v4.0.0/mod.ts';
```

### wrapFetch
Expand All @@ -23,7 +28,7 @@ Or

```js
// you can also pass your own wrapped fetch function, allowing for wrapping fetch multiple times
const wrappedfetch = wrapFetch({ fetchFn: yourFetch });
const wrappedfetch = wrapFetch({ fetch: yourFetch });
```

#### using the new wrappedfetch
Expand Down

0 comments on commit 88480ad

Please sign in to comment.