Steps to reproduce —
git clone http://github.com/paambaati/ky-body-timeout-repro
cd ky-body-timeout-repro
yarn install
node server.js
in a separate window. This will simulate a backend API in my case that returns JSON responses. It runs on port8080
.node index.js
in a separate window. This will simulate the frontend app's Node server. It runs on port8081
.curl http://localhost:8081/
When using a afterResponse
hook for responses over ~50KB (I'm not sure what this exact number is), the response.json()
Promise doesn't resolve.
In this repro, the API call would not return anything and eventually time out.
This can be tested out by fully removing the hooks
section from the ky
options object, and curl http://localhost:8081/
will correctly return the JSON.