mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 06:19:07 +00:00

Fixes: https://github.com/nodejs/node/issues/25935 PR-URL: https://github.com/nodejs/node/pull/25974 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
23 lines
578 B
JavaScript
23 lines
578 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const http = require('http');
|
|
const assert = require('assert');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
res.writeHead(200, { 'a-header': 'a-header-value' }).end('abc');
|
|
});
|
|
|
|
server.listen(0, () => {
|
|
http.get({ port: server.address().port }, (res) => {
|
|
assert.strictEqual(res.headers['a-header'], 'a-header-value');
|
|
|
|
const chunks = [];
|
|
|
|
res.on('data', (chunk) => chunks.push(chunk));
|
|
res.on('end', () => {
|
|
assert.strictEqual(Buffer.concat(chunks).toString(), 'abc');
|
|
server.close();
|
|
});
|
|
});
|
|
});
|