From 7b3d171a96369d83a9a58862ab0467852cb292a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Mon, 11 Dec 2017 10:24:21 +0800 Subject: [PATCH] fix the "write after end" error when in stream mode --- lib/requestHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 3c93e7b..a7e86ea 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -159,7 +159,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { res.on('end', () => { if (resDataStream) { - resDataStream.emit('end'); // EOF + resDataStream.push(null); // indicate the stream is end } else { finishCollecting(); }