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

Make Response.arrayBuffer() always resolve with a ArrayBuffer #816

Merged
merged 2 commits into from Jul 31, 2020

Conversation

JakeChampion
Copy link
Owner

Fixes #801

@JakeChampion JakeChampion merged commit 37b55c2 into master Jul 31, 2020
@JakeChampion JakeChampion deleted the arraybuffer branch July 31, 2020 00:45
Copy link

@freund17 freund17 left a comment

Choose a reason for hiding this comment

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

I'm not familiar with the code base, but maybe it is a better idea to convert the view to a buffer, where it is set instead of where it is used.

Because there might be other places where code is expecting an ArrayBuffer instead of a view.

@@ -274,7 +274,17 @@ function Body() {

this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
consumed(this)

Choose a reason for hiding this comment

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

Consumed returns either undefined or a rejected Promise.

The previous code returned the rejected Promise.
This changes the original behaviour.
Was that intended?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Response.arrayBuffer() may resolve to ArrayBufferView
3 participants