Skip to content

Commit 13b230b

Browse files
committed
Add a test for redirect with stream body
See 35722f1.
1 parent aed2e69 commit 13b230b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ describe('node-fetch', () => {
367367
});
368368
});
369369

370+
it('should not follow non-GET redirect if body is a readable stream', function() {
371+
const url = `${base}redirect/307`;
372+
const opts = {
373+
method: 'PATCH',
374+
body: resumer().queue('a=1').end()
375+
};
376+
return expect(fetch(url, opts)).to.eventually.be.rejected
377+
.and.be.an.instanceOf(FetchError)
378+
.and.have.property('type', 'unsupported-redirect');
379+
});
380+
370381
it('should obey maximum redirect, reject case', function() {
371382
const url = `${base}redirect/chain`;
372383
const opts = {

0 commit comments

Comments
 (0)