As discussed in Pr #93:
afterResponse hooks are not executed for the following code:
const response = await ky.get('https://example.com', {
hooks: {
afterResponse: [
response => {
// This won't get called
}
]
}
});
const data = await response.json();
I know this is not how ky is supposed to be used, but it's easy to fall into this and see that everything is working, except the hooks.
Confirmed. From what I can see, the underlying problem also applies to our retry logic.
This code probably needs to be moved to a function and called both inside and outside of the loop.
Most helpful comment
Confirmed. From what I can see, the underlying problem also applies to our retry logic.
This code probably needs to be moved to a function and called both inside and outside of the loop.