From 740ab3d0cbdb535e56399318f1bae77dd694b7b6 Mon Sep 17 00:00:00 2001 From: Gergely Nemeth Date: Thu, 29 Jun 2017 09:36:01 +0200 Subject: [PATCH] test: add test for http outgoing internal headers PR-URL: https://github.com/nodejs/node/pull/13980 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Refael Ackermann --- .../test-http-outgoing-internal-headers.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/parallel/test-http-outgoing-internal-headers.js diff --git a/test/parallel/test-http-outgoing-internal-headers.js b/test/parallel/test-http-outgoing-internal-headers.js new file mode 100644 index 00000000000000..e36917a970d987 --- /dev/null +++ b/test/parallel/test-http-outgoing-internal-headers.js @@ -0,0 +1,28 @@ +// Flags: --expose-internals +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +const { outHeadersKey } = require('internal/http'); +const { OutgoingMessage } = require('http'); + +{ + // tests for _headers get method + const outgoingMessage = new OutgoingMessage(); + outgoingMessage.getHeaders = common.mustCall(); + outgoingMessage._headers; +} + +{ + // tests for _headers set method + const outgoingMessage = new OutgoingMessage(); + outgoingMessage._headers = { + host: 'risingstack.com', + Origin: 'localhost' + }; + + assert.deepStrictEqual(outgoingMessage[outHeadersKey], { + host: ['host', 'risingstack.com'], + origin: ['Origin', 'localhost'] + }); +}