Skip to content

Commit e44fabe

Browse files
committed
[test] add test for prependPath option
1 parent 9a534c6 commit e44fabe

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/lib-http-proxy-common-test.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('lib/http-proxy/common.js', function () {
2020
{
2121
method : 'i',
2222
url : 'am',
23-
headers : {'pro':'xy','overwritten':false}
23+
headers : {'pro':'xy','overwritten':false}
2424
});
2525

2626
expect(outgoing.host).to.eql('hey');
@@ -91,7 +91,7 @@ describe('lib/http-proxy/common.js', function () {
9191
it('set the port according to the protocol', function () {
9292
var outgoing = {};
9393
common.setupOutgoing(outgoing,
94-
{
94+
{
9595
agent : '?',
9696
target: {
9797
host : 'how',
@@ -103,7 +103,7 @@ describe('lib/http-proxy/common.js', function () {
103103
{
104104
method : 'i',
105105
url : 'am',
106-
headers : 'proxy'
106+
headers : 'proxy'
107107
});
108108

109109
expect(outgoing.host).to.eql('how');
@@ -140,6 +140,16 @@ describe('lib/http-proxy/common.js', function () {
140140

141141
expect(outgoing.path).to.eql('some-path/am');
142142
});
143+
144+
it('should not prepend the target path to the outgoing path with prependPath = false', function () {
145+
var outgoing = {};
146+
common.setupOutgoing(outgoing, {
147+
target: { path: 'hellothere' },
148+
prependPath: false
149+
}, { url: 'hi' });
150+
151+
expect(outgoing.path).to.eql('hi');
152+
})
143153
});
144154

145155
describe('#setupSocket', function () {

0 commit comments

Comments
 (0)