summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-compat-serverresponse-headers-send-date.js
blob: b22b1f7304038e222eb3103431c8e9f06e9f4068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
const common = require('../common');
if (!common.hasCrypto) { common.skip('missing crypto'); }
const assert = require('assert');
const http2 = require('http2');

const server = http2.createServer(common.mustCall((request, response) => {
  response.sendDate = false;
  response.writeHead(200);
  response.end();
}));

server.listen(0, common.mustCall(() => {
  const session = http2.connect(`http://localhost:${server.address().port}`);
  const req = session.request();

  req.on('response', common.mustCall((headers, flags) => {
    assert.strictEqual('Date' in headers, false);
    assert.strictEqual('date' in headers, false);
  }));

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