Skip to content

Commit 23acf8c

Browse files
committed
[test] Fix nits
1 parent cd89e07 commit 23acf8c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

test/websocket.test.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -3860,16 +3860,18 @@ describe('WebSocket', () => {
38603860

38613861
it('honors the `finishRequest` option', (done) => {
38623862
const wss = new WebSocket.Server({ port: 0 }, () => {
3863-
const ws = new WebSocket(`ws://localhost:${wss.address().port}`, {
3864-
finishRequest(request, websocket) {
3865-
process.nextTick(() => {
3866-
assert.strictEqual(request, ws._req);
3867-
assert.strictEqual(websocket, ws);
3868-
});
3869-
request.on('socket', (socket) => {
3863+
const host = `localhost:${wss.address().port}`;
3864+
const ws = new WebSocket(`ws://${host}`, {
3865+
finishRequest(req, ws) {
3866+
assert.ok(req instanceof http.ClientRequest);
3867+
assert.strictEqual(req.getHeader('host'), host);
3868+
assert.ok(ws instanceof WebSocket);
3869+
assert.strictEqual(req, ws._req);
3870+
3871+
req.on('socket', (socket) => {
38703872
socket.on('connect', () => {
3871-
request.setHeader('Cookie', 'foo=bar');
3872-
request.end();
3873+
req.setHeader('Cookie', 'foo=bar');
3874+
req.end();
38733875
});
38743876
});
38753877
}

0 commit comments

Comments
 (0)