mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[test] for override method feature
This commit is contained in:
parent
d533a1be43
commit
81d58c531b
@ -251,7 +251,7 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
|
|
||||||
expect(outgoing.path).to.eql('/' + google);
|
expect(outgoing.path).to.eql('/' + google);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not replace :\ to :\\ when no http word before', function () {
|
it('should not replace :\ to :\\ when no http word before', function () {
|
||||||
var outgoing = {};
|
var outgoing = {};
|
||||||
var google = 'http://google.com:/join/join.js'
|
var google = 'http://google.com:/join/join.js'
|
||||||
@ -262,7 +262,7 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
|
|
||||||
expect(outgoing.path).to.eql('/' + google);
|
expect(outgoing.path).to.eql('/' + google);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when using ignorePath', function () {
|
describe('when using ignorePath', function () {
|
||||||
it('should ignore the path of the `req.url` passed in but use the target path', function () {
|
it('should ignore the path of the `req.url` passed in but use the target path', function () {
|
||||||
var outgoing = {};
|
var outgoing = {};
|
||||||
@ -347,6 +347,16 @@ describe('lib/http-proxy/common.js', function () {
|
|||||||
expect(outgoing.secureProtocol).eql('my-secure-protocol');
|
expect(outgoing.secureProtocol).eql('my-secure-protocol');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle overriding the `method` of the http request', function () {
|
||||||
|
var outgoing = {};
|
||||||
|
common.setupOutgoing(outgoing, {
|
||||||
|
target: url.parse('https://whooooo.com'),
|
||||||
|
method: 'POST' ,
|
||||||
|
}, { method: 'GET', url: '' });
|
||||||
|
|
||||||
|
expect(outgoing.method).eql('POST');
|
||||||
|
});
|
||||||
|
|
||||||
// url.parse('').path => null
|
// url.parse('').path => null
|
||||||
it('should not pass null as last arg to #urlJoin', function(){
|
it('should not pass null as last arg to #urlJoin', function(){
|
||||||
var outgoing = {};
|
var outgoing = {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user