Socket
Socket
Sign inDemoInstall

http-proxy-middleware

Package Overview
Dependencies
43
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.3.2

4

package.json
{
"name": "http-proxy-middleware",
"version": "0.3.1",
"version": "0.3.2",
"description": "The one-liner proxy middleware for connect, express and browser-sync",

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

"is-glob": "^2.0.0",
"micromatch": "~2.1.6",
"micromatch": "^2.2.0",
"url": "^0.10.3"
}
}

@@ -117,5 +117,5 @@ # http-proxy-middleware

* `**` matches any path, all requests will be proxied.
* `**.html` matches any path which ends with `.html`
* `**/*.html` matches any path which ends with `.html`
* `/*.html` matches paths directly under path-absolute
* `/api/**.html` matches requests ending with `.html` in the path of `/api`
* `/api/**/*.html` matches requests ending with `.html` in the path of `/api`
* `['/api/**', '/ajax/**']` combine multiple patterns

@@ -122,0 +122,0 @@ * `['/api/**', '!**/bad.json']` exclusion

@@ -85,6 +85,7 @@ var expect = require('chai').expect;

expect(contextMatcher.match('**', url)).to.be.true;
expect(contextMatcher.match('**/*', url)).to.be.true;
expect(contextMatcher.match('**/*.*', url)).to.be.true;
expect(contextMatcher.match('/**', url)).to.be.true;
expect(contextMatcher.match('**.*', url)).to.be.true;
expect(contextMatcher.match('/**.*', url)).to.be.true;
expect(contextMatcher.match('**/*.*', url)).to.be.true;
expect(contextMatcher.match('/**/*', url)).to.be.true;
expect(contextMatcher.match('/**/*.*', url)).to.be.true;

@@ -94,5 +95,7 @@ });

it('should only match .html files', function () {
expect(contextMatcher.match('**.html', url)).to.be.true;
expect(contextMatcher.match('**.htm', url)).to.be.false;
expect(contextMatcher.match('**.jpg', url)).to.be.false;
expect(contextMatcher.match('**/*.html', url)).to.be.true;
expect(contextMatcher.match('/**.html', url)).to.be.true;
expect(contextMatcher.match('/**/*.html', url)).to.be.true;
expect(contextMatcher.match('/**.htm', url)).to.be.false;
expect(contextMatcher.match('/**.jpg', url)).to.be.false;
});

@@ -107,4 +110,4 @@

it('should only match .php files with query params', function () {
expect(contextMatcher.match('**.php', 'http://localhost/a/b/c.php?d=e&e=f')).to.be.false;
expect(contextMatcher.match('**.php?*', 'http://localhost/a/b/c.php?d=e&e=f')).to.be.true;
expect(contextMatcher.match('/**/*.php', 'http://localhost/a/b/c.php?d=e&e=f')).to.be.false;
expect(contextMatcher.match('/**/*.php?*', 'http://localhost/a/b/c.php?d=e&e=f')).to.be.true;
});

@@ -140,3 +143,3 @@

it('should return true when both file extensions pattern match', function () {
var pattern = ['**.html','**.jpeg'];
var pattern = ['/**.html','/**.jpeg'];
expect(contextMatcher.match(pattern, 'http://localhost/api/foo/bar.html')).to.be.true;

@@ -151,4 +154,4 @@ expect(contextMatcher.match(pattern, 'http://localhost/api/foo/bar.jpeg')).to.be.true;

var url = 'http://localhost/api/foo/bar.html';
expect(contextMatcher.match(['**', '!**.html'], url)).to.be.false;
expect(contextMatcher.match(['**', '!**.json'], url)).to.be.true;
expect(contextMatcher.match(['**', '!**/*.html'], url)).to.be.false;
expect(contextMatcher.match(['**', '!**/*.json'], url)).to.be.true;
});

@@ -155,0 +158,0 @@ });

@@ -208,3 +208,3 @@ var expect = require('chai').expect;

beforeEach(function () {
var mw_proxy = proxyMiddleware(['**.html', '!**.json'], {target:'http://localhost:8000'});
var mw_proxy = proxyMiddleware(['/**.html', '!**.json'], {target:'http://localhost:8000'});

@@ -211,0 +211,0 @@ var mw_target = function (req, res, next) {

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