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

fetch: make consumeBody sync #3606

Closed
wants to merge 2 commits into from
Closed

fetch: make consumeBody sync #3606

wants to merge 2 commits into from

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Sep 13, 2024

consumeBody does not need to be async.

Comment on lines 426 to +432
if (bodyUnusable(object)) {
throw new TypeError('Body is unusable: Body has already been read')
return Promise.reject(new TypeError('Body is unusable: Body has already been read'))
}

throwIfAborted(object[kState])
if (object[kState].aborted) {
return Promise.reject(new DOMException('The operation was aborted.', 'AbortError'))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I thin aborted is a subtype of the object being unusable. Does it have to be a DOMException?

Copy link
Member

@KhafraDev KhafraDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this type of change makes maintaining these sections annoying and prone to errors

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Sep 20, 2024

Despite saving one promise i also dislike the try catch. Retractng.

@Uzlopak Uzlopak closed this Sep 20, 2024
@Uzlopak Uzlopak deleted the fetch-consume-body-sync branch September 20, 2024 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants