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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
  • Loading branch information
gergelyke authored and refack committed Jul 18, 2017
1 parent c3cb0ed commit f406a7e
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 f406a7e

Please sign in to comment.