@elastic/transport
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -267,3 +267,3 @@ "use strict"; | ||
async request(params, options = {}) { | ||
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13; | ||
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16; | ||
const connectionParams = { | ||
@@ -336,6 +336,8 @@ method: params.method, | ||
headers['content-type'] = (_6 = headers['content-type']) !== null && _6 !== void 0 ? _6 : this[symbols_1.kJsonContentType]; | ||
headers.accept = (_7 = headers.accept) !== null && _7 !== void 0 ? _7 : this[symbols_1.kJsonContentType]; | ||
} | ||
else { | ||
if (params.body !== '') { | ||
headers['content-type'] = (_7 = headers['content-type']) !== null && _7 !== void 0 ? _7 : 'text/plain'; | ||
headers['content-type'] = (_8 = headers['content-type']) !== null && _8 !== void 0 ? _8 : 'text/plain'; | ||
headers.accept = (_9 = headers.accept) !== null && _9 !== void 0 ? _9 : this[symbols_1.kAcceptHeader]; | ||
} | ||
@@ -360,3 +362,4 @@ connectionParams.body = params.body; | ||
if (connectionParams.body !== '') { | ||
headers['content-type'] = (_8 = headers['content-type']) !== null && _8 !== void 0 ? _8 : this[symbols_1.kNdjsonContentType]; | ||
headers['content-type'] = (_10 = headers['content-type']) !== null && _10 !== void 0 ? _10 : this[symbols_1.kNdjsonContentType]; | ||
headers.accept = (_11 = headers.accept) !== null && _11 !== void 0 ? _11 : this[symbols_1.kJsonContentType]; | ||
} | ||
@@ -396,3 +399,3 @@ } | ||
} | ||
headers.accept = (_9 = headers.accept) !== null && _9 !== void 0 ? _9 : this[symbols_1.kAcceptHeader]; | ||
headers.accept = (_12 = headers.accept) !== null && _12 !== void 0 ? _12 : this[symbols_1.kAcceptHeader]; | ||
connectionParams.headers = headers; | ||
@@ -433,7 +436,7 @@ while (meta.attempts <= maxRetries) { | ||
} | ||
const contentEncoding = ((_10 = headers['content-encoding']) !== null && _10 !== void 0 ? _10 : '').toLowerCase(); | ||
const contentEncoding = ((_13 = headers['content-encoding']) !== null && _13 !== void 0 ? _13 : '').toLowerCase(); | ||
if (contentEncoding.includes('gzip') || contentEncoding.includes('deflate')) { | ||
body = await unzip(body); | ||
} | ||
const isVectorTile = ((_11 = headers['content-type']) !== null && _11 !== void 0 ? _11 : '').includes('application/vnd.mapbox-vector-tile'); | ||
const isVectorTile = ((_14 = headers['content-type']) !== null && _14 !== void 0 ? _14 : '').includes('application/vnd.mapbox-vector-tile'); | ||
if (Buffer.isBuffer(body) && !isVectorTile) { | ||
@@ -448,4 +451,4 @@ body = body.toString(); | ||
if (headers['content-type'] !== undefined && | ||
(((_12 = headers['content-type']) === null || _12 === void 0 ? void 0 : _12.includes('application/json')) || | ||
((_13 = headers['content-type']) === null || _13 === void 0 ? void 0 : _13.includes('application/vnd.elasticsearch+json'))) && | ||
(((_15 = headers['content-type']) === null || _15 === void 0 ? void 0 : _15.includes('application/json')) || | ||
((_16 = headers['content-type']) === null || _16 === void 0 ? void 0 : _16.includes('application/vnd.elasticsearch+json'))) && | ||
!isHead && body !== '') { // eslint-disable-line | ||
@@ -452,0 +455,0 @@ result.body = this[symbols_1.kSerializer].deserialize(body); |
{ | ||
"name": "@elastic/transport", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227417
3545