Skip to content

Commit 72ea7d5

Browse files
update README with example
1 parent 05d489d commit 72ea7d5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ const { status, data: pets } = await findPetsByStatus({
6868
console.log(pets[0])
6969
```
7070

71+
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.
72+
73+
To continue from the example above, it would look something like this:
74+
75+
```ts
76+
// fetch
77+
const { status, data: pets } = await findPetsByStatus({
78+
status: ['available', 'pending'],
79+
undefined,
80+
['keyToParamToBePersistedToBody']
81+
})
82+
```
83+
7184
### Typed Error Handling
7285

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

193-
Happy fetching! 👍
206+
Happy fetching! 👍

0 commit comments

Comments
 (0)