When got throwing errors afterResponse hook fired 3 times
afterResponse should be fired only once
http.extend({
hooks: {
beforeRequest: [
options => {
console.log(
'Request: %s %s',
options.method,
options.url?.toString(),
);
},
],
afterResponse: [
response => {
const pathname = response.requestUrl.pathname;
const method = response.request.options.method;
const statusCode = response.statusCode;
console.log(
'Response: %s %s %s %s',
method,
statusCode,
pathname,
);
return response;
},
],
},
}) as HttpClient;```
<!--
We encourage you to submit a pull request with a failing test:
- This will make it more likely for us to prioritize your issue.
- It's a good way to prove that the issue is related to Got and not your code.
Example: https://github.com/avajs/ava/blob/master/docs/01-writing-tests.md#failing-tests
-->
#### Checklist
- [ ] I have read the documentation.
- [ ] I have tried my code with the latest version of Node.js and Got.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too