node/test/parallel/test-set-incoming-message-header.js
Rich Trott 6a84f1c403
Revert "http: headers(Distinct), trailers(Distinct) setters to be no-op"
This reverts commit 4d723c7fd6.

I'm not sure if we should re-apply this as a semver-major change or if
we should accept it as valid and add tests/documentation, but either
way, we have to revert it at least temporarily.

Closes: https://github.com/nodejs/node/issues/45510
PR-URL: https://github.com/nodejs/node/pull/45527
Fixes: https://github.com/nodejs/node/issues/45510
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2022-11-21 22:36:29 +00:00

28 lines
725 B
JavaScript

'use strict';
require('../common');
const { IncomingMessage } = require('http');
const assert = require('assert');
// Headers setter function set a header correctly
{
const im = new IncomingMessage();
im.headers = { key: 'value' };
assert.deepStrictEqual(im.headers, { key: 'value' });
}
// Trailers setter function set a header correctly
{
const im = new IncomingMessage();
im.trailers = { key: 'value' };
assert.deepStrictEqual(im.trailers, { key: 'value' });
}
// _addHeaderLines function set a header correctly
{
const im = new IncomingMessage();
im.headers = { key1: 'value1' };
im._addHeaderLines(['key2', 'value2'], 2);
assert.deepStrictEqual(im.headers, { key1: 'value1', key2: 'value2' });
}