Skip to content

Commit 8ea5444

Browse files
committed
Addressed minor things in commit comments
1 parent 028b108 commit 8ea5444

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ npm install http-proxy-rules --save
3535

3636
// a test method is exposed on the proxy rules instance
3737
// to test a request to see if it matches against one of the specified rules
38-
var target;
39-
if (target = proxyRules.test(req)) {
38+
var target = proxyRules.match(req);
39+
if (target) {
4040
return proxy.web(req, res, {
4141
target: target
4242
});

example/simple.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module.exports = function spawnReverseProxy(cb) {
2323

2424
// a test method is exposed on the proxy rules instance
2525
// to test a request to see if it matches against one of the specified rules
26-
var target;
27-
if (target = proxyRules.test(req)) {
26+
var target = proxyRules.match(req);
27+
if (target) {
2828
return proxy.web(req, res, {
2929
target: target
3030
});

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
/**
3+
* This is a constructor for a HttpProxyRules instance.
4+
* @param {Object} options Takes in a `rules` obj, (optional) `default` target
5+
*/
26
function HttpProxyRules(options) {
37
this.rules = options.rules;
48
this.default = options.default || null;
@@ -9,9 +13,9 @@ function HttpProxyRules(options) {
913
/**
1014
* This function will modify the `req` object if a match is found.
1115
* We also return the new endpoint string if a match is found.
12-
* @param {Object} options Takes in a `req`, `rules`, (optional) `default` params.
16+
* @param {Object} options Takes in a `req` object.
1317
*/
14-
HttpProxyRules.prototype.test = function test(req) {
18+
HttpProxyRules.prototype.match = function match(req) {
1519
var rules = this.rules;
1620
var target = this.default;
1721
var path = req.url;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-proxy-rules",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "A proxy rules add-on to the node-http-proxy module.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)