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

Commit

Permalink
http2: add test-http2-date-header.js
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed May 15, 2017
1 parent 5be7c8b commit 8a63c8e
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/parallel/test-http2-date-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';
require('../common');
const assert = require('assert');
const http2 = require('http2');

const testResBody = 'other stuff!\n';

const server = http2.createServer((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() {
const client = http2.connect(`http://localhost:${this.address().port}`);

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

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

req.resume();
});

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

req.end();
});

0 comments on commit 8a63c8e

Please sign in to comment.