diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 791a43c8d5d029..774c5824658434 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -30,7 +30,6 @@ const { ArrayPrototypeSome, ArrayPrototypeSplice, FunctionPrototypeCall, - NumberIsNaN, ObjectCreate, ObjectKeys, ObjectSetPrototypeOf, @@ -49,11 +48,6 @@ let debug = require('internal/util/debuglog').debuglog('http', (fn) => { }); const { AsyncResource } = require('async_hooks'); const { async_id_symbol } = require('internal/async_hooks').symbols; -const { - codes: { - ERR_OUT_OF_RANGE, - }, -} = require('internal/errors'); const { kEmptyObject, once, @@ -123,10 +117,7 @@ function Agent(options) { validateOneOf(this.scheduling, 'scheduling', ['fifo', 'lifo']); if (this.maxTotalSockets !== undefined) { - validateNumber(this.maxTotalSockets, 'maxTotalSockets'); - if (this.maxTotalSockets <= 0 || NumberIsNaN(this.maxTotalSockets)) - throw new ERR_OUT_OF_RANGE('maxTotalSockets', '> 0', - this.maxTotalSockets); + validateNumber(this.maxTotalSockets, 'maxTotalSockets', 1); } else { this.maxTotalSockets = Infinity; } diff --git a/test/parallel/test-http-agent-maxtotalsockets.js b/test/parallel/test-http-agent-maxtotalsockets.js index c44c8db627d330..fce1bf8de83144 100644 --- a/test/parallel/test-http-agent-maxtotalsockets.js +++ b/test/parallel/test-http-agent-maxtotalsockets.js @@ -20,8 +20,6 @@ assert.throws(() => new http.Agent({ }), { code: 'ERR_OUT_OF_RANGE', name: 'RangeError', - message: 'The value of "maxTotalSockets" is out of range. ' + - `It must be > 0. Received ${item}`, }); });