Compare commits

...

1 Commits

Author SHA1 Message Date
Ashcon Partovi
35245418b7 fix: test-http-outgoing-internal-headernames-setter.js 2025-03-21 14:39:28 -07:00
2 changed files with 32 additions and 0 deletions

View File

@@ -1598,6 +1598,23 @@ const OutgoingMessagePrototype = {
usesChunkedEncodingByDefault: true,
_closed: false,
get _headerNames() {
process.emitWarning("OutgoingMessage.prototype._headerNames is deprecated", "DeprecationWarning", "DEP0066");
const headers = this[headersSymbol];
if (!headers) return null;
const out = Object.create(null);
for (const key of headers.keys()) {
out[key.toLowerCase()] = key;
}
return out;
},
set _headerNames(val) {
process.emitWarning("OutgoingMessage.prototype._headerNames is deprecated", "DeprecationWarning", "DEP0066");
},
appendHeader(name, value) {
var headers = (this[headersSymbol] ??= new Headers());
headers.append(name, value);

View File

@@ -0,0 +1,15 @@
'use strict';
const common = require('../common');
const { OutgoingMessage } = require('http');
const warn = 'OutgoingMessage.prototype._headerNames is deprecated';
common.expectWarning('DeprecationWarning', warn, 'DEP0066');
{
// Tests for _headerNames set method
const outgoingMessage = new OutgoingMessage();
outgoingMessage._headerNames = {
'x-flow-id': '61bba6c5-28a3-4eab-9241-2ecaa6b6a1fd'
};
}