Skip to content

Commit

Permalink
[test] for override method feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrugzz authored and indexzero committed Apr 20, 2018
1 parent d533a1b commit 81d58c5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/lib-http-proxy-common-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('lib/http-proxy/common.js', function () {

expect(outgoing.path).to.eql('/' + google);
});

it('should not replace :\ to :\\ when no http word before', function () {
var outgoing = {};
var google = 'http://google.com:/join/join.js'
Expand All @@ -262,7 +262,7 @@ describe('lib/http-proxy/common.js', function () {

expect(outgoing.path).to.eql('/' + google);
});

describe('when using ignorePath', function () {
it('should ignore the path of the `req.url` passed in but use the target path', function () {
var outgoing = {};
Expand Down Expand Up @@ -347,6 +347,16 @@ describe('lib/http-proxy/common.js', function () {
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
it('should not pass null as last arg to #urlJoin', function(){
var outgoing = {};
Expand Down

0 comments on commit 81d58c5

Please sign in to comment.