Commit 389159da authored by indexzero's avatar indexzero

[api test] All tests are passing when run as individual files

parent e39a9f93
......@@ -96,6 +96,10 @@ exports.createServer = function () {
proxy.close();
});
proxy.on('routes', function (routes) {
server.emit('routes', routes);
})
if (!callback) {
// WebSocket support: if callback is empty tunnel
// websocket request automatically
......@@ -180,11 +184,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, port, host, paused) {
// always ignore the proxyTable if an explicit `port` and `host`
// arguments are supplied to `proxyRequest`.
//
if (this.proxyTable && !host) {
location = this.proxyTable.getProxyLocation(req);
if (!location) {
res.writeHead(400);
res.writeHead(404);
return res.end();
}
......
......@@ -73,9 +73,10 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
}
};
runner.startTargetServer(8103, that.output);
runner.startTargetServer(8103, that.output, function () {
request(options, that.callback);
});
});
},
"should receive 'hello dynamic.com'": function (err, res, body) {
assert.equal(body, this.output);
......@@ -88,8 +89,10 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
"When using an instance of ProxyTable combined with HttpProxy directly": {
topic: function () {
this.server = runner.startProxyServerWithTableAndLatency(8110, 100, {
router: {
'foo.com': 'localhost:8111',
'bar.com': 'localhost:8112'
}
}, this.callback);
},
"an incoming request to foo.com": assertProxiedWithTarget(runner, 'foo.com', 8110, 8111),
......@@ -99,7 +102,7 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
}).addBatch({
"When the tests are over": {
topic: function () {
fs.unlinkSync(routeFile);
//fs.unlinkSync(routeFile);
return runner.closeServers();
},
"the servers should clean up": function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment