Comparing version 0.0.1 to 0.0.2
@@ -35,5 +35,6 @@ | ||
var backendUrl = decodeURIComponent(req.url.substr( ("/" + prefix + "/").length )), | ||
var backendUrl = req.url.substr( ("/" + prefix + "/").length ), | ||
parsedUrl = url.parse(backendUrl); | ||
console.log('index- backendUrl: ', backendUrl); | ||
@@ -50,2 +51,3 @@ //adjust the req object. | ||
}else{ | ||
console.log('sending https request to: ', backendUrl); | ||
httpsProxy.proxyRequest(req, res, { | ||
@@ -52,0 +54,0 @@ host: parsedUrl.hostname, |
@@ -5,3 +5,3 @@ { | ||
"main" : "index.js", | ||
"version" : "0.0.1", | ||
"version" : "0.0.2", | ||
"dependencies" : { | ||
@@ -8,0 +8,0 @@ "http-proxy" : "*" |
var assert = require('assert'), | ||
cdroxy = require('../'), | ||
cdroxy = require('../'), | ||
connect = require('connect'), | ||
http = require('http'), | ||
request = require('request'); | ||
request = require('request'), | ||
url = require("url"); | ||
@@ -13,3 +14,7 @@ | ||
.use(function ( req, res ) { | ||
res.end("response from remote"); | ||
var query = url.parse(req.url).query; | ||
if (query) | ||
res.end(query); | ||
else | ||
res.end("response from remote"); | ||
}) | ||
@@ -34,3 +39,2 @@ .listen(9000); | ||
.get('http://localhost:8000/proxy/http://localhost:9000', function ( err, res, body ) { | ||
assert.ok(!err); | ||
@@ -43,2 +47,14 @@ assert.equal(res.statusCode, 200); | ||
it('should proxy encoded characters', function ( done ) { | ||
request | ||
.get({ | ||
uri: 'http://localhost:8000/proxy/http://localhost:9000/', | ||
qs: { q: 'foo bar' } | ||
}, function ( err, res, body ) { | ||
assert.equal(body, 'q=foo%20bar'); | ||
done(); | ||
}); | ||
}); | ||
it('should ignore urls outside /proxy/', function ( done ) { | ||
@@ -45,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5211
114