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 danielleadams committed Apr 24, 2022
1 parent 3d37efe commit 6d422ad
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 6d422ad

Please sign in to comment.