Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-aws-es

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-aws-es - npm Package Compare versions

Comparing version 3.1.3 to 4.0.0

src/node.js

3

CHANGELOG.md

@@ -0,1 +1,4 @@

### 4.0.0
* Use AWS XHRClient in browser. [#42][42]
### 3.1.2

@@ -2,0 +5,0 @@ * Fix unicode issue. [#43][43]

49

connector.js

@@ -16,3 +16,3 @@ 'use strict';

const HttpConnector = require('elasticsearch/src/lib/connectors/http');
const zlib = require('zlib');
const HttpClient = require('./src/node');

@@ -33,3 +33,3 @@ class HttpAmazonESConnector extends HttpConnector {

this.httpOptions = config.httpOptions || this.awsConfig.httpOptions;
this.httpClient = new AWS.NodeHttpClient();
this.httpClient = new HttpClient();
}

@@ -41,6 +41,2 @@

let req;
let status = 0;
let headers = {};
let response;
let incoming;
let cancelled;

@@ -53,14 +49,5 @@

// general clean-up procedure to run after the request
// completes, has an error, or is aborted.
const cleanUp = (err) => {
req && req.removeAllListeners();
incoming && incoming.removeAllListeners();
const done = (err, response, status, headers) => {
this.log.trace(params.method, reqParams, params.body, response, status);
if (err instanceof Error) {
cb(err);
} else {
cb(null, response, status, headers);
}
cb(err, response, status, headers);
};

@@ -80,30 +67,7 @@

const request = this.createRequest(params, reqParams);
// Sign the request (Sigv4)
this.signRequest(request, creds);
req = this.httpClient.handleRequest(request, this.httpOptions, function (_incoming) {
incoming = _incoming;
status = incoming.statusCode;
headers = incoming.headers;
response = '';
let encoding = (headers['content-encoding'] || '').toLowerCase();
if (encoding === 'gzip' || encoding === 'deflate') {
incoming = incoming.pipe(zlib.createUnzip());
}
incoming.setEncoding('utf8');
incoming.on('data', function (d) {
response += d;
});
incoming.on('error', cleanUp);
incoming.on('end', cleanUp);
}, cleanUp);
req.setNoDelay(true);
req.setSocketKeepAlive(true);
req = this.httpClient.handleRequest(request, this.httpOptions, done);
})
.catch(cleanUp);
.catch(done);

@@ -139,3 +103,2 @@ return cancel;

}
request.headers['presigned-expires'] = false;
request.headers['Host'] = this.endpoint.host;

@@ -142,0 +105,0 @@

{
"name": "http-aws-es",
"version": "3.1.3",
"version": "4.0.0",
"description": "Use the elasticsearch-js client with Amazon ES",

@@ -26,8 +26,11 @@ "repository": "https://github.com/TheDeveloper/http-aws-es",

"aws-sdk": "^2.138.0",
"browserify": "^14.5.0",
"chai": "^4.1.2",
"elasticsearch": "^13.3.1",
"eslint": "^4.9.0",
"express": "^4.16.2",
"minimist": "^1.2.0",
"mocha": "^4.0.1",
"nyc": "^11.2.1",
"puppeteer": "^0.12.0",
"sinon": "^4.0.0"

@@ -39,6 +42,9 @@ },

"posttest": "npm run lint",
"lint": "eslint ."
"lint": "eslint connector.js src"
},
"browser": {
"./src/node.js": "./src/xhr.js"
},
"author": "Geoff Wagstaff <geoff@gosquared.com>",
"license": "MIT"
}

@@ -43,3 +43,5 @@ # Connection handler for Amazon ES [<img title="Version" src="https://img.shields.io/npm/v/http-aws-es.svg?style=flat-square" />](https://www.npmjs.org/package/http-aws-es)

```bash
npm test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com --region us-east-1
npm test
# test against a real endpoint
AWS_PROFILE=your-profile npm run integration-test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com --region us-east-1
```
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