From 2a850cd0664a4eee51f44d0bb8c2f7a3fe444154 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 20 May 2019 10:29:03 +0200 Subject: http: call write callback even if there is no message body Ensure that the callback of `OutgoingMessage.prototype.write()` is called when `outgoingMessage._hasBody` is `false` (HEAD method, 204 status code, etc.). Refs: https://github.com/nodejs/node/pull/27709 PR-URL: https://github.com/nodejs/node/pull/27777 Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott --- lib/_http_outgoing.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/_http_outgoing.js') diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index cb09e764fe..a4a2b3ab14 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -573,6 +573,7 @@ function write_(msg, chunk, encoding, callback, fromEnd) { if (!msg._hasBody) { debug('This type of response MUST NOT have a body. ' + 'Ignoring write() calls.'); + if (callback) process.nextTick(callback); return true; } -- cgit v1.2.3