diff options
author | Yoshiki Kurihara <yosyos0306@gmail.com> | 2022-03-15 02:28:20 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2022-04-24 05:47:19 +0300 |
commit | 6d422ad807b1edeb024e9f8d7df69c8417ad8477 (patch) | |
tree | e30bb1110b23e4aa9374392771925161bd8479c5 | |
parent | 3d37efe5884bf42e2055ecafd41e9579cd71c57f (diff) |
test: improve _http_incoming.js coverage
PR-URL: https://github.com/nodejs/node/pull/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>
-rw-r--r-- | test/parallel/test-set-incoming-message-header.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parallel/test-set-incoming-message-header.js b/test/parallel/test-set-incoming-message-header.js new file mode 100644 index 00000000000..9ac05a8138d --- /dev/null +++ b/test/parallel/test-set-incoming-message-header.js @@ -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' }); +} |