Repository: nodejs/node
Pull request: http: remove outgoingmessage _headers and _headersList

These have been deprecated for a long time.

cc @nodejs/tsc

Changed files:
filename: doc/api/deprecations.md
patch: @@ -1545,6 +1545,9 @@ removed. Please use `sloppy` instead.
 
 <!-- YAML
 changes:
+  - version: REPLACEME
+    pr-url: https://github.com/nodejs/node/pull/57551
+    description: End-of-Life.
   - version: v12.0.0
     pr-url: https://github.com/nodejs/node/pull/24167
     description: Runtime deprecation.
@@ -1553,7 +1556,7 @@ changes:
     description: Documentation-only deprecation.
 -->
 
-Type: Runtime
+Type: End-of-Life
 
 The `node:http` module `OutgoingMessage.prototype._headers` and
 `OutgoingMessage.prototype._headerNames` properties are deprecated. Use one of

filename: lib/_http_outgoing.js
patch: @@ -38,7 +38,6 @@ const { getDefaultHighWaterMark } = require('internal/streams/state');
 const assert = require('internal/assert');
 const EE = require('events');
 const Stream = require('stream');
-const internalUtil = require('internal/util');
 const { kOutHeaders, utcDate, kNeedDrain } = require('internal/http');
 const { Buffer } = require('buffer');
 const {
@@ -211,27 +210,6 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'writableCorked', {
   },
 });
 
-ObjectDefineProperty(OutgoingMessage.prototype, '_headers', {
-  __proto__: null,
-  get: internalUtil.deprecate(function() {
-    return this.getHeaders();
-  }, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
-  set: internalUtil.deprecate(function(val) {
-    if (val == null) {
-      this[kOutHeaders] = null;
-    } else if (typeof val === 'object') {
-      const headers = this[kOutHeaders] = { __proto__: null };
-      const keys = ObjectKeys(val);
-      // Retain for(;;) loop for performance reasons
-      // Refs: https://github.com/nodejs/node/pull/30958
-      for (let i = 0; i < keys.length; ++i) {
-        const name = keys[i];
-        headers[name.toLowerCase()] = [name, val[name]];
-      }
-    }
-  }, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
-});
-
 ObjectDefineProperty(OutgoingMessage.prototype, 'connection', {
   __proto__: null,
   get: function() {
@@ -256,42 +234,6 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'socket', {
   },
 });
 
-ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
-  __proto__: null,
-  get: internalUtil.deprecate(function() {
-    const headers = this[kOutHeaders];
-    if (headers !== null) {
-      const out = { __proto__: null };
-      const keys = ObjectKeys(headers);
-      // Retain for(;;) loop for performance reasons
-      // Refs: https://github.com/nodejs/node/pull/30958
-      for (let i = 0; i < keys.length; ++i) {
-        const key = keys[i];
-        const val = headers[key][0];
-        out[key] = val;
-      }
-      return out;
-    }
-    return null;
-  }, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
-  set: internalUtil.deprecate(function(val) {
-    if (typeof val === 'object' && val !== null) {
-      const headers = this[kOutHeaders];
-      if (!headers)
-        return;
-      const keys = ObjectKeys(val);
-      // Retain for(;;) loop for performance reasons
-      // Refs: https://github.com/nodejs/node/pull/30958
-      for (let i = 0; i < keys.length; ++i) {
-        const header = headers[keys[i]];
-        if (header)
-          header[0] = val[keys[i]];
-      }
-    }
-  }, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
-});
-
-
 OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
   if (this._header) {
     throw new ERR_HTTP_HEADERS_SENT('render');

filename: test/parallel/test-http-outgoing-internal-headernames-getter.js
patch: @@ -1,23 +0,0 @@
-'use strict';
-const common = require('../common');
-
-const { OutgoingMessage } = require('http');
-const assert = require('assert');
-
-const warn = 'OutgoingMessage.prototype._headerNames is deprecated';
-common.expectWarning('DeprecationWarning', warn, 'DEP0066');
-
-{
-  // Tests for _headerNames get method
-  const outgoingMessage = new OutgoingMessage();
-  outgoingMessage._headerNames; // eslint-disable-line no-unused-expressions
-}
-
-{
-  // Tests _headerNames getter result after setting a header.
-  const outgoingMessage = new OutgoingMessage();
-  outgoingMessage.setHeader('key', 'value');
-  const expect = { __proto__: null };
-  expect.key = 'key';
-  assert.deepStrictEqual(outgoingMessage._headerNames, expect);
-}

filename: test/parallel/test-http-outgoing-internal-headernames-setter.js
patch: @@ -1,15 +0,0 @@
-'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'
-  };
-}

filename: test/parallel/test-http-outgoing-internal-headers.js
patch: @@ -1,44 +0,0 @@
-// Flags: --expose-internals
-'use strict';
-const common = require('../common');
-const assert = require('assert');
-
-const { kOutHeaders } = require('internal/http');
-const { OutgoingMessage } = require('http');
-
-const warn = 'OutgoingMessage.prototype._headers is deprecated';
-common.expectWarning('DeprecationWarning', warn, 'DEP0066');
-
-{
-  // Tests for _headers get method
-  const outgoingMessage = new OutgoingMessage();
-  outgoingMessage.getHeaders = common.mustCall();
-  outgoingMessage._headers; // eslint-disable-line no-unused-expressions
-}
-
-{
-  // Tests for _headers set method
-  const outgoingMessage = new OutgoingMessage();
-  outgoingMessage._headers = {
-    host: 'risingstack.com',
-    Origin: 'localhost'
-  };
-
-  assert.deepStrictEqual(
-    Object.entries(outgoingMessage[kOutHeaders]),
-    Object.entries({
-      host: ['host', 'risingstack.com'],
-      origin: ['Origin', 'localhost']
-    }));
-}
-
-{
-  // Tests for _headers set method `null`
-  const outgoingMessage = new OutgoingMessage();
-  outgoingMessage._headers = null;
-
-  assert.strictEqual(
-    outgoingMessage[kOutHeaders],
-    null
-  );
-}