Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
node-http-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
node-http-proxy
Commits
389159da
Commit
389159da
authored
Mar 09, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[api test] All tests are passing when run as individual files
parent
e39a9f93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
lib/node-http-proxy.js
lib/node-http-proxy.js
+6
-1
test/proxy-table-test.js
test/proxy-table-test.js
+8
-5
No files found.
lib/node-http-proxy.js
View file @
389159da
...
@@ -95,6 +95,10 @@ exports.createServer = function () {
...
@@ -95,6 +95,10 @@ exports.createServer = function () {
server
.
on
(
'
close
'
,
function
()
{
server
.
on
(
'
close
'
,
function
()
{
proxy
.
close
();
proxy
.
close
();
});
});
proxy
.
on
(
'
routes
'
,
function
(
routes
)
{
server
.
emit
(
'
routes
'
,
routes
);
})
if
(
!
callback
)
{
if
(
!
callback
)
{
// WebSocket support: if callback is empty tunnel
// WebSocket support: if callback is empty tunnel
...
@@ -180,11 +184,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, port, host, paused) {
...
@@ -180,11 +184,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, port, host, paused) {
// always ignore the proxyTable if an explicit `port` and `host`
// always ignore the proxyTable if an explicit `port` and `host`
// arguments are supplied to `proxyRequest`.
// arguments are supplied to `proxyRequest`.
//
//
if
(
this
.
proxyTable
&&
!
host
)
{
if
(
this
.
proxyTable
&&
!
host
)
{
location
=
this
.
proxyTable
.
getProxyLocation
(
req
);
location
=
this
.
proxyTable
.
getProxyLocation
(
req
);
if
(
!
location
)
{
if
(
!
location
)
{
res
.
writeHead
(
40
0
);
res
.
writeHead
(
40
4
);
return
res
.
end
();
return
res
.
end
();
}
}
...
...
test/proxy-table-test.js
View file @
389159da
...
@@ -73,8 +73,9 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
...
@@ -73,8 +73,9 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
}
}
};
};
runner
.
startTargetServer
(
8103
,
that
.
output
);
runner
.
startTargetServer
(
8103
,
that
.
output
,
function
()
{
request
(
options
,
that
.
callback
);
request
(
options
,
that
.
callback
);
});
});
});
},
},
"
should receive 'hello dynamic.com'
"
:
function
(
err
,
res
,
body
)
{
"
should receive 'hello dynamic.com'
"
:
function
(
err
,
res
,
body
)
{
...
@@ -88,8 +89,10 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
...
@@ -88,8 +89,10 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
"
When using an instance of ProxyTable combined with HttpProxy directly
"
:
{
"
When using an instance of ProxyTable combined with HttpProxy directly
"
:
{
topic
:
function
()
{
topic
:
function
()
{
this
.
server
=
runner
.
startProxyServerWithTableAndLatency
(
8110
,
100
,
{
this
.
server
=
runner
.
startProxyServerWithTableAndLatency
(
8110
,
100
,
{
'
foo.com
'
:
'
localhost:8111
'
,
router
:
{
'
bar.com
'
:
'
localhost:8112
'
'
foo.com
'
:
'
localhost:8111
'
,
'
bar.com
'
:
'
localhost:8112
'
}
},
this
.
callback
);
},
this
.
callback
);
},
},
"
an incoming request to foo.com
"
:
assertProxiedWithTarget
(
runner
,
'
foo.com
'
,
8110
,
8111
),
"
an incoming request to foo.com
"
:
assertProxiedWithTarget
(
runner
,
'
foo.com
'
,
8110
,
8111
),
...
@@ -99,7 +102,7 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
...
@@ -99,7 +102,7 @@ vows.describe('node-http-proxy/proxy-table').addBatch({
}).
addBatch
({
}).
addBatch
({
"
When the tests are over
"
:
{
"
When the tests are over
"
:
{
topic
:
function
()
{
topic
:
function
()
{
fs
.
unlinkSync
(
routeFile
);
//
fs.unlinkSync(routeFile);
return
runner
.
closeServers
();
return
runner
.
closeServers
();
},
},
"
the servers should clean up
"
:
function
()
{
"
the servers should clean up
"
:
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment