Skip to content

Commit 6bf148e

Browse files
kylo5abyrichardlau
authored andcommitted
http: fix close return value mismatch between doc and implementation
PR-URL: #51797 Fixes: #51787 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent cea90dc commit 6bf148e

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

lib/_http_server.js

+1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ ObjectSetPrototypeOf(Server, net.Server);
561561
Server.prototype.close = function() {
562562
httpServerPreClose(this);
563563
ReflectApply(net.Server.prototype.close, this, arguments);
564+
return this;
564565
};
565566

566567
Server.prototype[SymbolAsyncDispose] = async function() {

lib/https.js

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Server.prototype.setTimeout = HttpServer.prototype.setTimeout;
111111
Server.prototype.close = function() {
112112
httpServerPreClose(this);
113113
ReflectApply(tls.Server.prototype.close, this, arguments);
114+
return this;
114115
};
115116

116117
Server.prototype[SymbolAsyncDispose] = async function() {

test/parallel/test-http-server.js

+1
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,5 @@ process.on('exit', function() {
139139
assert.match(server_response, quit);
140140

141141
assert.strictEqual(client_got_eof, true);
142+
assert.strictEqual(server.close(), server);
142143
});

0 commit comments

Comments
 (0)