More lenient parameter checks (v7) (#1663)

This commit is contained in:
Tomas Della Vedova
2022-03-30 13:34:46 +02:00
committed by GitHub
parent 14d0dfc488
commit 7f13a73bd3

View File

@ -120,15 +120,15 @@ class Client extends ESAPI {
maxCompressedResponseSize: null maxCompressedResponseSize: null
}, opts) }, opts)
if (options.maxResponseSize !== null && options.maxResponseSize > buffer.constants.MAX_STRING_LENGTH) { if (options.maxResponseSize != null && options.maxResponseSize > buffer.constants.MAX_STRING_LENGTH) {
throw new ConfigurationError(`The maxResponseSize cannot be bigger than ${buffer.constants.MAX_STRING_LENGTH}`) throw new ConfigurationError(`The maxResponseSize cannot be bigger than ${buffer.constants.MAX_STRING_LENGTH}`)
} }
if (options.maxCompressedResponseSize !== null && options.maxCompressedResponseSize > buffer.constants.MAX_LENGTH) { if (options.maxCompressedResponseSize != null && options.maxCompressedResponseSize > buffer.constants.MAX_LENGTH) {
throw new ConfigurationError(`The maxCompressedResponseSize cannot be bigger than ${buffer.constants.MAX_LENGTH}`) throw new ConfigurationError(`The maxCompressedResponseSize cannot be bigger than ${buffer.constants.MAX_LENGTH}`)
} }
if (options.caFingerprint !== null && isHttpConnection(opts.node || opts.nodes)) { if (options.caFingerprint != null && isHttpConnection(opts.node || opts.nodes)) {
throw new ConfigurationError('You can\'t configure the caFingerprint with a http connection') throw new ConfigurationError('You can\'t configure the caFingerprint with a http connection')
} }