unjs / ofetch

😱 A better fetch API. Works on node, browser and workers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support modify params when retry

vaynevayne opened this issue · comments

Describe the feature

In this network era, the retry due to bad network is rare, most of the time, retry when you need to modify the request parameters, so I hope to provide this feature

let fruit = 'apple'

await ofetch(`http://google.com/fruit`, {
retry:(options)=> {
const  {params,headers,body,...rest} = options
return  {
...params,
params.fruit = 'banana'
}
}

})

Additional information

  • Would you be willing to help implement this feature?