Socket
Socket
Sign inDemoInstall

@elastic/transport

Package Overview
Dependencies
Maintainers
77
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/transport - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

3

lib/connection/UndiciConnection.js

@@ -113,2 +113,5 @@ "use strict";

};
if (requestParams.path[0] !== '/') {
requestParams.path = `/${requestParams.path}`;
}
// undici does not support per-request timeouts,

@@ -115,0 +118,0 @@ // to address this issue, we default to the constructor

29

lib/Transport.js

@@ -193,3 +193,3 @@ "use strict";

this[symbols_1.kNodeSelector] = (_z = opts.nodeSelector) !== null && _z !== void 0 ? _z : roundRobinSelector();
this[symbols_1.kHeaders] = Object.assign({}, { 'user-agent': userAgent, accept: 'application/vnd.elasticsearch+json; compatible-with=8,text/plain' }, opts.compression === true ? { 'accept-encoding': 'gzip,deflate' } : null, lowerCaseHeaders(opts.headers));
this[symbols_1.kHeaders] = Object.assign({}, { 'user-agent': userAgent }, opts.compression === true ? { 'accept-encoding': 'gzip,deflate' } : null, lowerCaseHeaders(opts.headers));
this[symbols_1.kDiagnostic] = (_0 = opts.diagnostic) !== null && _0 !== void 0 ? _0 : new Diagnostic_1.default();

@@ -247,3 +247,3 @@ this[symbols_1.kConnectionPool] = opts.connectionPool;

async request(params, options = {}) {
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
const meta = {

@@ -321,3 +321,3 @@ context: null,

headers['content-type'] = (_3 = headers['content-type']) !== null && _3 !== void 0 ? _3 : 'application/vnd.elasticsearch+json; compatible-with=8';
headers.accept = 'application/vnd.elasticsearch+json; compatible-with=8';
headers.accept = (_4 = headers.accept) !== null && _4 !== void 0 ? _4 : 'application/vnd.elasticsearch+json; compatible-with=8';
}

@@ -340,7 +340,6 @@ // handle ndjson body

if (connectionParams.body !== '') {
headers['content-type'] = (_4 = headers['content-type']) !== null && _4 !== void 0 ? _4 : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8';
headers.accept = 'application/vnd.elasticsearch+json; compatible-with=8';
headers['content-type'] = (_5 = headers['content-type']) !== null && _5 !== void 0 ? _5 : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8';
headers.accept = (_6 = headers.accept) !== null && _6 !== void 0 ? _6 : 'application/vnd.elasticsearch+json; compatible-with=8';
}
}
connectionParams.headers = headers;
// serializes the querystring

@@ -361,3 +360,3 @@ if (options.querystring == null) {

if (compression) {
connectionParams.headers['content-encoding'] = 'gzip';
headers['content-encoding'] = 'gzip';
connectionParams.body = connectionParams.body.pipe(createGzip());

@@ -376,9 +375,11 @@ }

}
connectionParams.headers['content-encoding'] = 'gzip';
connectionParams.headers['content-length'] = '' + Buffer.byteLength(connectionParams.body); // eslint-disable-line
headers['content-encoding'] = 'gzip';
headers['content-length'] = '' + Buffer.byteLength(connectionParams.body); // eslint-disable-line
}
else {
connectionParams.headers['content-length'] = '' + Buffer.byteLength(connectionParams.body); // eslint-disable-line
headers['content-length'] = '' + Buffer.byteLength(connectionParams.body); // eslint-disable-line
}
}
headers.accept = (_7 = headers.accept) !== null && _7 !== void 0 ? _7 : 'application/vnd.elasticsearch+json; compatible-with=8,text/plain';
connectionParams.headers = headers;
while (meta.attempts <= maxRetries) {

@@ -412,7 +413,7 @@ try {

}
const contentEncoding = ((_5 = headers['content-encoding']) !== null && _5 !== void 0 ? _5 : '').toLowerCase();
const contentEncoding = ((_8 = headers['content-encoding']) !== null && _8 !== void 0 ? _8 : '').toLowerCase();
if (contentEncoding.includes('gzip') || contentEncoding.includes('deflate')) {
body = await unzip(body);
}
const isVectorTile = ((_6 = headers['content-type']) !== null && _6 !== void 0 ? _6 : '').includes('application/vnd.mapbox-vector-tile');
const isVectorTile = ((_9 = headers['content-type']) !== null && _9 !== void 0 ? _9 : '').includes('application/vnd.mapbox-vector-tile');
if (Buffer.isBuffer(body) && !isVectorTile) {

@@ -433,4 +434,4 @@ body = body.toString();

if (headers['content-type'] !== undefined &&
(((_7 = headers['content-type']) === null || _7 === void 0 ? void 0 : _7.includes('application/json')) ||
((_8 = headers['content-type']) === null || _8 === void 0 ? void 0 : _8.includes('application/vnd.elasticsearch+json'))) &&
(((_10 = headers['content-type']) === null || _10 === void 0 ? void 0 : _10.includes('application/json')) ||
((_11 = headers['content-type']) === null || _11 === void 0 ? void 0 : _11.includes('application/vnd.elasticsearch+json'))) &&
!isHead && body !== '') { // eslint-disable-line

@@ -437,0 +438,0 @@ result.body = this[symbols_1.kSerializer].deserialize(body);

{
"name": "@elastic/transport",
"version": "0.0.9",
"version": "0.0.10",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc