{"action":"created","issue":{"url":"https://api.github.com/repos/mzabriskie/axios/issues/459","repository_url":"https://api.github.com/repos/mzabriskie/axios","labels_url":"https://api.github.com/repos/mzabriskie/axios/issues/459/labels{/name}","comments_url":"https://api.github.com/repos/mzabriskie/axios/issues/459/comments","events_url":"https://api.github.com/repos/mzabriskie/axios/issues/459/events","html_url":"https://github.com/mzabriskie/axios/issues/459","id":179927685,"number":459,"title":"Response timeout?","user":{"login":"olalonde","id":416585,"avatar_url":"https://avatars.githubusercontent.com/u/416585?v=3","gravatar_id":"","url":"https://api.github.com/users/olalonde","html_url":"https://github.com/olalonde","followers_url":"https://api.github.com/users/olalonde/followers","following_url":"https://api.github.com/users/olalonde/following{/other_user}","gists_url":"https://api.github.com/users/olalonde/gists{/gist_id}","starred_url":"https://api.github.com/users/olalonde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olalonde/subscriptions","organizations_url":"https://api.github.com/users/olalonde/orgs","repos_url":"https://api.github.com/users/olalonde/repos","events_url":"https://api.github.com/users/olalonde/events{/privacy}","received_events_url":"https://api.github.com/users/olalonde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-29T00:57:14Z","updated_at":"2016-10-12T08:08:53Z","closed_at":null,"body":"The following code doesn't work as expected (no timeout error is fired):\r\n\r\n```javascript\r\n client.get('/stop-writing-body-halfway', {\r\n    timeout: 100,\r\n })\r\n```\r\n\r\nAfter a few minutes, a response is resolved despite `Content-Length` not having been reached and the server not explicitly closing the connection. **Edit**: never mind the connection is probably closed after 2 mins because of https://nodejs.org/api/http.html#http_server_timeout\r\n\r\nMy server never closes the connection and stops writing the body half way:\r\n\r\n```javascript\r\n  const stopWritingBodyHalfway = (msg, res) => {\r\n    res.setHeader('Content-Length', 500)\r\n    const body = Buffer.alloc(250, 'a')\r\n    res.write(body)\r\n  }\r\n```\r\n\r\nIs the timeout only for the request, not for the response?"},"comment":{"url":"https://api.github.com/repos/mzabriskie/axios/issues/comments/253147015","html_url":"https://github.com/mzabriskie/axios/issues/459#issuecomment-253147015","issue_url":"https://api.github.com/repos/mzabriskie/axios/issues/459","id":253147015,"user":{"login":"dtryon","id":782603,"avatar_url":"https://avatars.githubusercontent.com/u/782603?v=3","gravatar_id":"","url":"https://api.github.com/users/dtryon","html_url":"https://github.com/dtryon","followers_url":"https://api.github.com/users/dtryon/followers","following_url":"https://api.github.com/users/dtryon/following{/other_user}","gists_url":"https://api.github.com/users/dtryon/gists{/gist_id}","starred_url":"https://api.github.com/users/dtryon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtryon/subscriptions","organizations_url":"https://api.github.com/users/dtryon/orgs","repos_url":"https://api.github.com/users/dtryon/repos","events_url":"https://api.github.com/users/dtryon/events{/privacy}","received_events_url":"https://api.github.com/users/dtryon/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T08:08:53Z","updated_at":"2016-10-12T08:08:53Z","body":"@olalonde Yes, exactly.  At the moment, the current timeout is cleared *before* the response body has been completely received:\r\n\r\nhttps://github.com/mzabriskie/axios/blob/master/lib/adapters/http.js#L116\r\n\r\nThe timeout gets cleared before the body stream is processed.\r\n\r\nInstead the timeout could be be cleared later (when the body has been completely received).\r\n\r\n"}}
{"actor":{"display_login":"dtryon"}}