mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
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>
This commit is contained in:
parent
447635b440
commit
20e372c242
3 changed files with 36 additions and 2 deletions
19
test/parallel/test-http-set-max-idle-http-parser.js
Normal file
19
test/parallel/test-http-set-max-idle-http-parser.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
'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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue