mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[test] add test for prependPath option
This commit is contained in:
parent
9a534c6ff6
commit
e44fabe58a
@ -20,7 +20,7 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
{
|
{
|
||||||
method : 'i',
|
method : 'i',
|
||||||
url : 'am',
|
url : 'am',
|
||||||
headers : {'pro':'xy','overwritten':false}
|
headers : {'pro':'xy','overwritten':false}
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(outgoing.host).to.eql('hey');
|
expect(outgoing.host).to.eql('hey');
|
||||||
@ -91,7 +91,7 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
it('set the port according to the protocol', function () {
|
it('set the port according to the protocol', function () {
|
||||||
var outgoing = {};
|
var outgoing = {};
|
||||||
common.setupOutgoing(outgoing,
|
common.setupOutgoing(outgoing,
|
||||||
{
|
{
|
||||||
agent : '?',
|
agent : '?',
|
||||||
target: {
|
target: {
|
||||||
host : 'how',
|
host : 'how',
|
||||||
@ -103,7 +103,7 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
{
|
{
|
||||||
method : 'i',
|
method : 'i',
|
||||||
url : 'am',
|
url : 'am',
|
||||||
headers : 'proxy'
|
headers : 'proxy'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(outgoing.host).to.eql('how');
|
expect(outgoing.host).to.eql('how');
|
||||||
@ -140,6 +140,16 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
|
|
||||||
expect(outgoing.path).to.eql('some-path/am');
|
expect(outgoing.path).to.eql('some-path/am');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not prepend the target path to the outgoing path with prependPath = false', function () {
|
||||||
|
var outgoing = {};
|
||||||
|
common.setupOutgoing(outgoing, {
|
||||||
|
target: { path: 'hellothere' },
|
||||||
|
prependPath: false
|
||||||
|
}, { url: 'hi' });
|
||||||
|
|
||||||
|
expect(outgoing.path).to.eql('hi');
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#setupSocket', function () {
|
describe('#setupSocket', function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user