Skip to content

Commit

Permalink
test: add test for http outgoing internal headers
Browse files Browse the repository at this point in the history
PR-URL: #13980
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
gergelyke authored and addaleax committed Jul 18, 2017
1 parent 0f52b41 commit 86e55ef
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/parallel/test-http-outgoing-internal-headers.js
Original file line number Diff line number Diff line change
@@ -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']
});
}

0 comments on commit 86e55ef

Please sign in to comment.