[test] for override method feature

This commit is contained in:
Jarrett Cruger 2018-04-19 16:57:35 -04:00 committed by Charlie Robbins
parent d533a1be43
commit 81d58c531b

View File

@ -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 = {};