@elastic/transport
Advanced tools
Comparing version 8.0.0-beta.1 to 8.0.0-beta.2
@@ -143,3 +143,3 @@ "use strict"; | ||
// @ts-expect-error method it's fine as string | ||
response = await this.pool.request(requestParams); | ||
response = (await this.pool.request(requestParams)); | ||
if (timeoutId != null) | ||
@@ -163,3 +163,3 @@ clearTimeout(timeoutId); | ||
const contentEncoding = ((_o = response.headers['content-encoding']) !== null && _o !== void 0 ? _o : '').toLowerCase(); | ||
const isCompressed = contentEncoding.includes('gzip') || contentEncoding.includes('deflate'); | ||
const isCompressed = contentEncoding.includes('gzip') || contentEncoding.includes('deflate'); // eslint-disable-line | ||
const isVectorTile = ((_p = response.headers['content-type']) !== null && _p !== void 0 ? _p : '').includes('application/vnd.mapbox-vector-tile'); | ||
@@ -169,3 +169,3 @@ /* istanbul ignore else */ | ||
const contentLength = Number(response.headers['content-length']); | ||
if (isCompressed && contentLength > maxCompressedResponseSize) { | ||
if (isCompressed && contentLength > maxCompressedResponseSize) { // eslint-disable-line | ||
response.body.destroy(); | ||
@@ -181,3 +181,3 @@ throw new errors_1.RequestAbortedError(`The content length (${contentLength}) is bigger than the maximum allowed buffer (${maxCompressedResponseSize})`); | ||
try { | ||
if (isCompressed || isVectorTile) { | ||
if (isCompressed || isVectorTile) { // eslint-disable-line | ||
const payload = []; | ||
@@ -184,0 +184,0 @@ for await (const chunk of response.body) { |
@@ -402,3 +402,3 @@ "use strict"; | ||
result.headers = headers; | ||
if (this[symbols_1.kProductCheck] != null && headers['x-elastic-product'] !== this[symbols_1.kProductCheck] && statusCode !== 401 && statusCode !== 403) { | ||
if (this[symbols_1.kProductCheck] != null && headers['x-elastic-product'] !== this[symbols_1.kProductCheck] && statusCode >= 200 && statusCode < 300) { | ||
throw new errors_1.ProductNotSupportedError(this[symbols_1.kProductCheck], result); | ||
@@ -405,0 +405,0 @@ } |
{ | ||
"name": "@elastic/transport", | ||
"version": "8.0.0-beta.1", | ||
"version": "8.0.0-beta.2", | ||
"description": "Transport classes and utilities shared among Node.js Elastic client libraries", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
222646