Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ const { status, data: pets } = await findPetsByStatus({
console.log(pets[0])
```

If you have a path argument that you also want to appear in the root of the body payload, you can pass an optional third parameter to the created fetch method.

To continue from the example above, it would look something like this:

```ts
// fetch
const { status, data: pets } = await findPetsByStatus({
status: ['available', 'pending'],
undefined,
['keyToParamToBePersistedToBody']
})
```

### Typed Error Handling

A non-ok fetch response throws a generic `ApiError`
Expand Down Expand Up @@ -190,4 +203,4 @@ const body = arrayRequestBody([{ item: 1}], { param: 2})
// body type is { item: number }[] & { param: number }
```

Happy fetching! 👍
Happy fetching! 👍
Loading