diff --git a/test/parallel/test-http-outgoing-internal-headernames-getter.js b/test/parallel/test-http-outgoing-internal-headernames-getter.js index 4a56a1301050b5..2d8238066e0cd4 100644 --- a/test/parallel/test-http-outgoing-internal-headernames-getter.js +++ b/test/parallel/test-http-outgoing-internal-headernames-getter.js @@ -2,6 +2,7 @@ const common = require('../common'); const { OutgoingMessage } = require('http'); +const assert = require('assert'); const warn = 'OutgoingMessage.prototype._headerNames is deprecated'; common.expectWarning('DeprecationWarning', warn, 'DEP0066'); @@ -11,3 +12,12 @@ common.expectWarning('DeprecationWarning', warn, 'DEP0066'); 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 = Object.create(null); + expect.key = 'key'; + assert.deepStrictEqual(outgoingMessage._headerNames, expect); +}