Skip to content

Commit

Permalink
test: improve _http_incoming.js coverage
Browse files Browse the repository at this point in the history
PR-URL: #42211
Refs: https://coverage.nodejs.org/coverage-010cb714161102de/lib/_http_incoming.js.html
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
kuriyosh authored and bengl committed Mar 21, 2022
1 parent 4941791 commit dfdce7c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/parallel/test-set-incoming-message-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

require('../common');
const { IncomingMessage } = require('http');
const assert = require('assert');

// Headers setter function set a header correctly
{
const im = new IncomingMessage();
im.headers = { key: 'value' };
assert.deepStrictEqual(im.headers, { key: 'value' });
}

// Trailers setter function set a header correctly
{
const im = new IncomingMessage();
im.trailers = { key: 'value' };
assert.deepStrictEqual(im.trailers, { key: 'value' });
}

// _addHeaderLines function set a header correctly
{
const im = new IncomingMessage();
im.headers = { key1: 'value1' };
im._addHeaderLines(['key2', 'value2'], 2);
assert.deepStrictEqual(im.headers, { key1: 'value1', key2: 'value2' });
}

0 comments on commit dfdce7c

Please sign in to comment.