Socket
Socket
Sign inDemoInstall

express-request-proxy

Package Overview
Dependencies
12
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.2.0

test/abort.js

10

lib/proxy.js

@@ -81,9 +81,17 @@ var _ = require('lodash'),

var apiRequest;
var originalApiRequest;
if (is.hasBody(req)) {
debug('piping req body to remote http endpoint');
apiRequest = req.pipe(request(apiRequestOptions));
originalApiRequest = request(apiRequestOptions);
apiRequest = req.pipe(originalApiRequest);
} else {
apiRequest = request(apiRequestOptions);
originalApiRequest = apiRequest;
}
// Abort api request if client close its connection
req.on('close', function() {
originalApiRequest.abort();
});
apiRequest.on('error', function(err) {

@@ -90,0 +98,0 @@ unhandledApiError(err, next);

7

package.json
{
"name": "express-request-proxy",
"version": "2.1.1",
"version": "2.2.0",
"description": "Intelligent http proxy Express middleware",
"main": "index.js",
"scripts": {
"test": "mocha --reporter spec --bail --check-leaks test/",
"test": "mocha --reporter spec --bail --exit --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --exit --check-leaks test/",
"lint": "eslint --cache ./lib index.js"

@@ -45,2 +45,3 @@ },

"compression": "^1.7.2",
"coveralls": "^3.0.2",
"dash-assert": "^1.3.1",

@@ -47,0 +48,0 @@ "eslint": "^4.19.1",

@@ -120,5 +120,4 @@ # express-request-proxy

```js
app.all(
"/api/protected/:resource",
requestProxy({
app.all("/api/protected/:resource", function(req, res, next) {
var proxy = requestProxy({
url: "http://remoteapi.com/api",

@@ -128,4 +127,5 @@ query: {

}
})
);
});
proxy(req, res, next);
});
```

@@ -265,5 +265,5 @@

[travis-url]: https://travis-ci.org/dvonlehman/express-request-proxy
[coveralls-image]: https://img.shields.io/coveralls/4front/express-request-proxy.svg?style=flat
[coveralls-image]: https://img.shields.io/coveralls/dvonlehman/express-request-proxy.svg?style=flat
[coveralls-url]: https://coveralls.io/r/dvonlehman/express-request-proxy?branch=master
[downloads-image]: https://img.shields.io/npm/dm/express-request-proxy.svg?style=flat
[downloads-url]: https://npmjs.org/package/express-request-proxy

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc