http: fix close return value mismatch between doc and implementation

PR-URL: https://github.com/nodejs/node/pull/51797
Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
kylo5aby 2024-02-27 00:07:39 +08:00 committed by GitHub
parent 6cb8a60bcc
commit 60ce0783a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 0 deletions

View File

@ -570,6 +570,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() {

View File

@ -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() {

View File

@ -139,4 +139,5 @@ process.on('exit', function() {
assert.match(server_response, quit);
assert.strictEqual(client_got_eof, true);
assert.strictEqual(server.close(), server);
});