File tree 4 files changed +11
-7
lines changed
4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ npm install http-proxy-rules --save
35
35
36
36
// a test method is exposed on the proxy rules instance
37
37
// 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) {
40
40
return proxy .web (req, res, {
41
41
target: target
42
42
});
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ module.exports = function spawnReverseProxy(cb) {
23
23
24
24
// a test method is exposed on the proxy rules instance
25
25
// 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 ) {
28
28
return proxy . web ( req , res , {
29
29
target : target
30
30
} ) ;
Original file line number Diff line number Diff line change 1
1
2
+ /**
3
+ * This is a constructor for a HttpProxyRules instance.
4
+ * @param {Object } options Takes in a `rules` obj, (optional) `default` target
5
+ */
2
6
function HttpProxyRules ( options ) {
3
7
this . rules = options . rules ;
4
8
this . default = options . default || null ;
@@ -9,9 +13,9 @@ function HttpProxyRules(options) {
9
13
/**
10
14
* This function will modify the `req` object if a match is found.
11
15
* 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 .
13
17
*/
14
- HttpProxyRules . prototype . test = function test ( req ) {
18
+ HttpProxyRules . prototype . match = function match ( req ) {
15
19
var rules = this . rules ;
16
20
var target = this . default ;
17
21
var path = req . url ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " http-proxy-rules" ,
3
- "version" : " 0 .0.1 " ,
3
+ "version" : " 1 .0.0 " ,
4
4
"description" : " A proxy rules add-on to the node-http-proxy module." ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments