Update response.js (#1162)

Allow Response.clone() to persist the high water mark
This commit is contained in:
David Kingdon 2021-10-07 04:07:24 +02:00 committed by GitHub
parent 5756eaaec2
commit acc2cbaebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -95,7 +95,8 @@ export default class Response extends Body {
headers: this.headers,
ok: this.ok,
redirected: this.redirected,
size: this.size
size: this.size,
highWaterMark: this.highWaterMark
});
}

View File

@ -122,7 +122,8 @@ describe('Response', () => {
},
url: base,
status: 346,
statusText: 'production'
statusText: 'production',
highWaterMark: 789
});
const cl = res.clone();
expect(cl.headers.get('a')).to.equal('1');
@ -130,6 +131,7 @@ describe('Response', () => {
expect(cl.url).to.equal(base);
expect(cl.status).to.equal(346);
expect(cl.statusText).to.equal('production');
expect(cl.highWaterMark).to.equal(789)
expect(cl.ok).to.be.false;
// Clone body shouldn't be the same body
expect(cl.body).to.not.equal(body);