Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chained calls to response.clone() do not persist the high water mark #1161

Closed
davesidious opened this issue May 18, 2021 · 0 comments · Fixed by #1162
Closed

Chained calls to response.clone() do not persist the high water mark #1161

davesidious opened this issue May 18, 2021 · 0 comments · Fixed by #1162
Labels

Comments

@davesidious
Copy link
Contributor

When calling .clone() on a Response instance, the highWaterMark is persisted in the cloned body, but not in the cloned Request itself. This means that cloning the clone results in a lost highWaterMark.

Reproduction

Steps to reproduce the behavior:

const res = await fetch('https://httpbin.org/bytes/200', {
  highWaterMark: 1024 * 1024
})

console.log(res.highWaterMark) // Is set correctly

const cloneOne = res.clone()

console.log(cloneOne.highWaterMark) // Is undefined

const cloneTwo = cloneOne.clone()

console.log(cloneTwo.highWaterMark) // Is undefined

Expected behavior

const res = await fetch('https://httpbin.org/bytes/200', {
  highWaterMark: 1024 * 1024
})

console.log(res.highWaterMark) // Is set correctly

const cloneOne = res.clone()

console.log(cloneOne.highWaterMark) // Is set correctly

const cloneTwo = cloneOne.clone()

console.log(cloneTwo.highWaterMark) // Is set correctly
software version
node-fetch 3.0.0-beta.9
node 14.16.1
npm 6.14.12
Operating System Ubuntu 20.04.2 LTS
@tekwiz tekwiz linked a pull request Oct 7, 2021 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant