mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix: test-http-listening.js
This commit is contained in:
@@ -749,6 +749,7 @@ const ServerPrototype = {
|
||||
return;
|
||||
}
|
||||
this[serverSymbol] = undefined;
|
||||
this.listening = false;
|
||||
if (typeof optionalCallback === "function") this.once("close", optionalCallback);
|
||||
server.stop();
|
||||
},
|
||||
|
||||
16
test/js/node/test/parallel/test-http-listening.js
Normal file
16
test/js/node/test/parallel/test-http-listening.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer();
|
||||
|
||||
assert.strictEqual(server.listening, false);
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
assert.strictEqual(server.listening, true);
|
||||
|
||||
server.close(common.mustCall(() => {
|
||||
assert.strictEqual(server.listening, false);
|
||||
}));
|
||||
}));
|
||||
Reference in New Issue
Block a user