Skip to content

Commit e1fabe4

Browse files
authored
http: remove outgoingmessage _headers and _headersList
PR-URL: #57551 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Tim Perry <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Stefan Stojanovic <[email protected]>
1 parent 5a2614f commit e1fabe4

5 files changed

+4
-141
lines changed

doc/api/deprecations.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,9 @@ removed. Please use `sloppy` instead.
15451545

15461546
<!-- YAML
15471547
changes:
1548+
- version: REPLACEME
1549+
pr-url: https://github.com/nodejs/node/pull/57551
1550+
description: End-of-Life.
15481551
- version: v12.0.0
15491552
pr-url: https://github.com/nodejs/node/pull/24167
15501553
description: Runtime deprecation.
@@ -1553,7 +1556,7 @@ changes:
15531556
description: Documentation-only deprecation.
15541557
-->
15551558

1556-
Type: Runtime
1559+
Type: End-of-Life
15571560

15581561
The `node:http` module `OutgoingMessage.prototype._headers` and
15591562
`OutgoingMessage.prototype._headerNames` properties are deprecated. Use one of

lib/_http_outgoing.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const { getDefaultHighWaterMark } = require('internal/streams/state');
3838
const assert = require('internal/assert');
3939
const EE = require('events');
4040
const Stream = require('stream');
41-
const internalUtil = require('internal/util');
4241
const { kOutHeaders, utcDate, kNeedDrain } = require('internal/http');
4342
const { Buffer } = require('buffer');
4443
const {
@@ -211,27 +210,6 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'writableCorked', {
211210
},
212211
});
213212

214-
ObjectDefineProperty(OutgoingMessage.prototype, '_headers', {
215-
__proto__: null,
216-
get: internalUtil.deprecate(function() {
217-
return this.getHeaders();
218-
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
219-
set: internalUtil.deprecate(function(val) {
220-
if (val == null) {
221-
this[kOutHeaders] = null;
222-
} else if (typeof val === 'object') {
223-
const headers = this[kOutHeaders] = { __proto__: null };
224-
const keys = ObjectKeys(val);
225-
// Retain for(;;) loop for performance reasons
226-
// Refs: https://github.com/nodejs/node/pull/30958
227-
for (let i = 0; i < keys.length; ++i) {
228-
const name = keys[i];
229-
headers[name.toLowerCase()] = [name, val[name]];
230-
}
231-
}
232-
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
233-
});
234-
235213
ObjectDefineProperty(OutgoingMessage.prototype, 'connection', {
236214
__proto__: null,
237215
get: function() {
@@ -256,42 +234,6 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'socket', {
256234
},
257235
});
258236

259-
ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
260-
__proto__: null,
261-
get: internalUtil.deprecate(function() {
262-
const headers = this[kOutHeaders];
263-
if (headers !== null) {
264-
const out = { __proto__: null };
265-
const keys = ObjectKeys(headers);
266-
// Retain for(;;) loop for performance reasons
267-
// Refs: https://github.com/nodejs/node/pull/30958
268-
for (let i = 0; i < keys.length; ++i) {
269-
const key = keys[i];
270-
const val = headers[key][0];
271-
out[key] = val;
272-
}
273-
return out;
274-
}
275-
return null;
276-
}, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
277-
set: internalUtil.deprecate(function(val) {
278-
if (typeof val === 'object' && val !== null) {
279-
const headers = this[kOutHeaders];
280-
if (!headers)
281-
return;
282-
const keys = ObjectKeys(val);
283-
// Retain for(;;) loop for performance reasons
284-
// Refs: https://github.com/nodejs/node/pull/30958
285-
for (let i = 0; i < keys.length; ++i) {
286-
const header = headers[keys[i]];
287-
if (header)
288-
header[0] = val[keys[i]];
289-
}
290-
}
291-
}, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
292-
});
293-
294-
295237
OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
296238
if (this._header) {
297239
throw new ERR_HTTP_HEADERS_SENT('render');

test/parallel/test-http-outgoing-internal-headernames-getter.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/parallel/test-http-outgoing-internal-headernames-setter.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/parallel/test-http-outgoing-internal-headers.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)