Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
[squash] review: add common must-call
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed Jun 6, 2017
1 parent 24c3779 commit 8faa0d1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/parallel/test-http2-date-header.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
'use strict';

require('../common');
const common = require('../common');
const assert = require('assert');
const http2 = require('http2');

const testResBody = 'other stuff!\n';

const server = http2.createServer((req, res) => {
const server = http2.createServer(common.mustCall((req, res) => {
assert.ok(!('date' in req.headers),
'Request headers did not contain a date.');
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end(testResBody);
});
}));
server.listen(0);

server.on('listening', function() {
server.on('listening', common.mustCall(function() {
const client = http2.connect(`http://localhost:${this.address().port}`);

const headers = { ':path': '/' };
const req = client.request(headers).setEncoding('utf8');

req.on('response', (headers) => {
req.on('response', common.mustCall((headers) => {
assert.ok('date' in headers,
'Response headers contain a date.');

req.resume();
});
}));

req.on('end', () => {
req.on('end', common.mustCall(() => {
server.close();
process.exit();
});
}));

req.end();
});
}));

0 comments on commit 8faa0d1

Please sign in to comment.