Socket
Socket
Sign inDemoInstall

express-request-proxy

Package Overview
Dependencies
97
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

3

lib/proxy.js

@@ -24,2 +24,3 @@ var querystring = require('querystring'),

options = _.defaults(options || {}, {
method: 'GET',
ensureAuthenticated: false,

@@ -89,3 +90,3 @@ cache: null,

debug("making API call to %s", apiRequestOptions.url);
debug("making %s call to %s", apiRequestOptions.method, apiRequestOptions.url);
var apiRequest = request(apiRequestOptions);

@@ -92,0 +93,0 @@ apiRequest.on('error', function(err) {

@@ -14,2 +14,7 @@ var parseUrl = require('url').parse;

// If an explicit method was not specified on the options, then use the
// method of the inbound request to the proxy.
if (!requestOptions.method)
requestOptions.method = req.method;
// Ensure that passed in options for timeout and maxRedirects cannot exceed

@@ -16,0 +21,0 @@ // the platform imposed limits (if defined).

{
"name": "express-request-proxy",
"version": "1.0.4",
"version": "1.0.5",
"description": "Intelligent http proxy Express middleware",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -185,2 +185,29 @@ var assert = require('assert');

});
it('uses method from the req', function() {
var req = {
method: 'post'
};
var endpointOptions = {
url: 'http://someapi.com'
};
var opts = requestOptions(req, endpointOptions);
assert.equal(opts.method, req.method);
});
it('uses method from the options', function() {
var req = {
method: 'post'
};
var endpointOptions = {
url: 'http://someapi.com',
method: 'put'
};
var opts = requestOptions(req, endpointOptions);
assert.equal(opts.method, endpointOptions.method);
});
});
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