Skip to content

Commit 7bae98d

Browse files
attempting a persistParams option to fix path/body key deletion
fix error fix persistParams fix type undo encodeURI in this branch only for PR to original repo update README with example
1 parent cda7665 commit 7bae98d

File tree

4 files changed

+6435
-42
lines changed

4 files changed

+6435
-42
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)