We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 does not comply with specs
Response.bodyUsed
const response = new Response(); expect(response.bodyUsed).toEqual(false); // OK expect(await response.text()).toEqual(''); expect(response.bodyUsed).toEqual(true); // Fail
Once the response has been read bodyUsed should be true This what Chrome, Firefox, WebKit, old Edge, node-fetch and whatwg-fetch do
bodyUsed
From the spec: https://fetch.spec.whatwg.org/#dom-body-bodyused
The bodyUsed getter steps are to return true if this’s body is non-null and this’s body’s stream is disturbed; otherwise false.
The text was updated successfully, but these errors were encountered:
Chrome console disagrees:
<< const response = new Response() >> undefined << response.bodyUsed >> false << await response.text() >> '' << response.bodyUsed >> false
You can only have bodyUsed if there is a body, the default constructed Response has no body.
Sorry, something went wrong.
You are right, I'm sorry about this bad issue
FYI it's node-fetch & whatwg-fetch that are not spec compliant
No branches or pull requests
Bug Description
Response.bodyUsed
does not comply with specsOnce the response has been read
bodyUsed
should be trueThis what Chrome, Firefox, WebKit, old Edge, node-fetch and whatwg-fetch do
From the spec: https://fetch.spec.whatwg.org/#dom-body-bodyused
Environment
The text was updated successfully, but these errors were encountered: