Skip to content

Commit 81d58c5

Browse files
jcrugzzindexzero
authored andcommitted
[test] for override method feature
1 parent d533a1b commit 81d58c5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: test/lib-http-proxy-common-test.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('lib/http-proxy/common.js', function () {
251251

252252
expect(outgoing.path).to.eql('/' + google);
253253
});
254-
254+
255255
it('should not replace :\ to :\\ when no http word before', function () {
256256
var outgoing = {};
257257
var google = 'http://google.com:/join/join.js'
@@ -262,7 +262,7 @@ describe('lib/http-proxy/common.js', function () {
262262

263263
expect(outgoing.path).to.eql('/' + google);
264264
});
265-
265+
266266
describe('when using ignorePath', function () {
267267
it('should ignore the path of the `req.url` passed in but use the target path', function () {
268268
var outgoing = {};
@@ -347,6 +347,16 @@ describe('lib/http-proxy/common.js', function () {
347347
expect(outgoing.secureProtocol).eql('my-secure-protocol');
348348
});
349349

350+
it('should handle overriding the `method` of the http request', function () {
351+
var outgoing = {};
352+
common.setupOutgoing(outgoing, {
353+
target: url.parse('https://whooooo.com'),
354+
method: 'POST' ,
355+
}, { method: 'GET', url: '' });
356+
357+
expect(outgoing.method).eql('POST');
358+
});
359+
350360
// url.parse('').path => null
351361
it('should not pass null as last arg to #urlJoin', function(){
352362
var outgoing = {};

0 commit comments

Comments
 (0)