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

Response.bodyUsed should be false when there is no body #1684

Open
tkrotoff opened this issue Dec 1, 2022 · 1 comment · May be fixed by #1686
Open

Response.bodyUsed should be false when there is no body #1684

tkrotoff opened this issue Dec 1, 2022 · 1 comment · May be fixed by #1686
Labels

Comments

@tkrotoff
Copy link
Contributor

tkrotoff commented Dec 1, 2022

Reproduction

const response = new Response(); // <=== Response does not have a body
expect(response.bodyUsed).toEqual(false); // OK

expect(await response.text()).toEqual('');
expect(response.bodyUsed).toEqual(false); // KO: node-fetch returns true

Same problem with Response.error()

Expected behavior

Under Chrome 107:

<< const response = new Response()
<< response.bodyUsed
>> false
<< await response.text()
<< response.bodyUsed
>> false

Your Environment

software version
node-fetch 3.3.0
node 18.12.1
npm 8.19.2
Operating System macOS Monterey

Related issue: nodejs/undici#1794

@tkrotoff tkrotoff added the bug label Dec 1, 2022
@jimmywarting
Copy link
Collaborator

Happy to review a PR

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.

2 participants