summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-zero-length-header.js
blob: 7b142d75f003b6f0200c4983fab267e7214714ee (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
'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();
server.on('stream', (stream, headers) => {
  assert.deepStrictEqual(headers, {
    ':scheme': 'http',
    ':authority': `localhost:${server.address().port}`,
    ':method': 'GET',
    ':path': '/',
    'bar': '',
    '__proto__': null
  });
  stream.session.destroy();
  server.close();
});
server.listen(0, common.mustCall(() => {
  const client = http2.connect(`http://localhost:${server.address().port}/`);
  client.request({ ':path': '/', '': 'foo', 'bar': '' }).end();
}));