xref: /third_party/node/test/parallel/test-set-incoming-message-header.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst { IncomingMessage } = require('http');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// Headers setter function set a header correctly
81cb0ef41Sopenharmony_ci{
91cb0ef41Sopenharmony_ci  const im = new IncomingMessage();
101cb0ef41Sopenharmony_ci  im.headers = { key: 'value' };
111cb0ef41Sopenharmony_ci  assert.deepStrictEqual(im.headers, { key: 'value' });
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Trailers setter function set a header correctly
151cb0ef41Sopenharmony_ci{
161cb0ef41Sopenharmony_ci  const im = new IncomingMessage();
171cb0ef41Sopenharmony_ci  im.trailers = { key: 'value' };
181cb0ef41Sopenharmony_ci  assert.deepStrictEqual(im.trailers, { key: 'value' });
191cb0ef41Sopenharmony_ci}
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci// _addHeaderLines function set a header correctly
221cb0ef41Sopenharmony_ci{
231cb0ef41Sopenharmony_ci  const im = new IncomingMessage();
241cb0ef41Sopenharmony_ci  im.headers = { key1: 'value1' };
251cb0ef41Sopenharmony_ci  im._addHeaderLines(['key2', 'value2'], 2);
261cb0ef41Sopenharmony_ci  assert.deepStrictEqual(im.headers, { key1: 'value1', key2: 'value2' });
271cb0ef41Sopenharmony_ci}
28

Indexes created Thu Nov 07 10:32:03 CST 2024