0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-http-set-max-idle-http-parser.js
theanarkh 20e372c242
http: make idle http parser count configurable
PR-URL: https://github.com/nodejs/node/pull/43974
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-07-29 10:00:38 +01:00

20 lines
667 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const httpCommon = require('_http_common');
const http = require('http');
[Symbol(), {}, [], () => {}, 1n, true, '1', null, undefined].forEach((value) => {
assert.throws(() => http.setMaxIdleHTTPParsers(value), { code: 'ERR_INVALID_ARG_TYPE' });
});
[-1, -Infinity, NaN, 0, 1.1].forEach((value) => {
assert.throws(() => http.setMaxIdleHTTPParsers(value), { code: 'ERR_OUT_OF_RANGE' });
});
[1, Number.MAX_SAFE_INTEGER].forEach((value) => {
assert.notStrictEqual(httpCommon.parsers.max, value);
http.setMaxIdleHTTPParsers(value);
assert.strictEqual(httpCommon.parsers.max, value);
});