Open makhataibar opened 9 months ago
Works as expected.
Since got
retries on error by default, the hook is triggered each time.
From the docs:
To disable this option, set options.retry.limit to
0
.
Example:
await got("http://localhost:3000/noretry", {
retry: {
limit: 0,
},
// ....
})
@noxify I had retry limit in extended instance
container
.bind<HttpClient>(TYPES.HttpClient)
.toDynamicValue(context => {
return got.extend({
https: {
},
hooks: {
beforeRequest: [
options => {
},
],
},
retry: {
limit: 0,
},
}) as HttpClient;
})
.inSingletonScope()
.whenTargetIsDefault();
Hi @makhataibar, unfortunately I can't reproduce your described behavior.
here the repo which I have used to reproduce it: https://github.com/noxify/honojs-got And here the link to the test client for your case: https://github.com/noxify/honojs-got/blob/main/src/client-extend.ts
Could you please provide a repo which includes a running example which reproduce your issue.
Describe the bug
Actual behavior
When got throwing errors afterResponse hook fired 3 times
Expected behavior
afterResponse should be fired only once
Code to reproduce