Skip to content

Commit

Permalink
test: refactor test-http2-compat-serverresponse-finished.js
Browse files Browse the repository at this point in the history
PR-URL: #21929
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
antsmartian authored and targos committed Aug 1, 2018
1 parent 5047aa5 commit 52020dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-http2-compat-serverresponse-finished.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const net = require('net');

// Http2ServerResponse.finished
const server = h2.createServer();
server.listen(0, common.mustCall(function() {
server.listen(0, common.mustCall(() => {
const port = server.address().port;
server.once('request', common.mustCall(function(request, response) {
server.once('request', common.mustCall((request, response) => {
assert.ok(response.socket instanceof net.Socket);
assert.ok(response.connection instanceof net.Socket);
assert.strictEqual(response.socket, response.connection);

response.on('finish', common.mustCall(function() {
response.on('finish', common.mustCall(() => {
assert.strictEqual(response.socket, undefined);
assert.strictEqual(response.connection, undefined);
process.nextTick(common.mustCall(() => {
Expand All @@ -30,15 +30,15 @@ server.listen(0, common.mustCall(function() {
}));

const url = `http://localhost:${port}`;
const client = h2.connect(url, common.mustCall(function() {
const client = h2.connect(url, common.mustCall(() => {
const headers = {
':path': '/',
':method': 'GET',
':scheme': 'http',
':authority': `localhost:${port}`
};
const request = client.request(headers);
request.on('end', common.mustCall(function() {
request.on('end', common.mustCall(() => {
client.close();
}));
request.end();
Expand Down

0 comments on commit 52020dc

Please sign in to comment.