Skip to content

Commit

Permalink
http: fix close return value mismatch between doc and implementation
Browse files Browse the repository at this point in the history
PR-URL: #51797
Fixes: #51787
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
kylo5aby authored and marco-ippolito committed Feb 27, 2024
1 parent 5f94912 commit ec17fd7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ ObjectSetPrototypeOf(Server, net.Server);
Server.prototype.close = function() {
httpServerPreClose(this);
ReflectApply(net.Server.prototype.close, this, arguments);
return this;
};

Server.prototype[SymbolAsyncDispose] = async function() {
Expand Down
1 change: 1 addition & 0 deletions lib/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Server.prototype.setTimeout = HttpServer.prototype.setTimeout;
Server.prototype.close = function() {
httpServerPreClose(this);
ReflectApply(tls.Server.prototype.close, this, arguments);
return this;
};

Server.prototype[SymbolAsyncDispose] = async function() {
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,5 @@ process.on('exit', function() {
assert.match(server_response, quit);

assert.strictEqual(client_got_eof, true);
assert.strictEqual(server.close(), server);
});

0 comments on commit ec17fd7

Please sign in to comment.