test: add test for http outgoing internal headers
PR-URL: https://github.com/nodejs/node/pull/13980 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
c3cb0edd8d
commit
f406a7ebae
28
test/parallel/test-http-outgoing-internal-headers.js
Normal file
28
test/parallel/test-http-outgoing-internal-headers.js
Normal file
@ -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']
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user