make sure the default `highWaterMark` equals 16384

This commit is contained in:
Antoni Kepinski 2020-05-24 12:16:34 +02:00
parent a6a933fa5a
commit 498710d555
No known key found for this signature in database
GPG Key ID: C15767C6F117A9B6
2 changed files with 8 additions and 1 deletions

View File

@ -134,7 +134,7 @@ export default class Request extends Body {
input.compress : true);
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
this.highWaterMark = init.highWaterMark || input.highWaterMark;
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
}
get method() {

View File

@ -1791,6 +1791,13 @@ describe('node-fetch', () => {
);
});
it('the default highWaterMark should equal 16384', () => {
const url = `${base}hello`;
return fetch(url).then(res => {
expect(res.highWaterMark).to.equal(16384);
});
});
it('should timeout on cloning response without consuming one of the streams when the second packet size is equal default highWaterMark', function () {
this.timeout(300);
const url = local.mockResponse(res => {