Add a test for redirect with stream body

See 35722f19e5.
This commit is contained in:
Timothy Gu 2018-03-25 11:51:37 -07:00
parent aed2e69a39
commit 13b230b30b
1 changed files with 11 additions and 0 deletions

View File

@ -367,6 +367,17 @@ describe('node-fetch', () => {
});
});
it('should not follow non-GET redirect if body is a readable stream', function() {
const url = `${base}redirect/307`;
const opts = {
method: 'PATCH',
body: resumer().queue('a=1').end()
};
return expect(fetch(url, opts)).to.eventually.be.rejected
.and.be.an.instanceOf(FetchError)
.and.have.property('type', 'unsupported-redirect');
});
it('should obey maximum redirect, reject case', function() {
const url = `${base}redirect/chain`;
const opts = {