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

fix: support ArrayBufferView and ArrayBuffer as body #1584

Merged
merged 2 commits into from Aug 19, 2022

Conversation

LiviaMedeiros
Copy link
Contributor

Implementation-wise, do we really need to make a copy?

@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2022

Codecov Report

Merging #1584 (f0da2be) into main (dd613ef) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1584      +/-   ##
==========================================
- Coverage   94.91%   94.89%   -0.03%     
==========================================
  Files          50       50              
  Lines        4724     4724              
==========================================
- Hits         4484     4483       -1     
- Misses        240      241       +1     
Impacted Files Coverage Δ
lib/fetch/body.js 97.10% <100.00%> (ø)
lib/fetch/file.js 91.66% <0.00%> (-1.20%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd613ef...f0da2be. Read the comment docs.

Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

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

Needs a test

@KhafraDev
Copy link
Member

KhafraDev commented Jul 28, 2022

Implementation-wise, do we really need to make a copy?

Yes, see extract:

BufferSource

    Set source to a copy of the bytes held by object.

@LiviaMedeiros
Copy link
Contributor Author

Set source to a copy of the bytes held by object.

This is true spec-wise, but seems costly in implementation. I wonder if there is a workaround with better performance, considering that most other implementations do not expose Request.body directly.

Anyway, even if it's possible to optimize later, working code and spec compliance goes first.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

ping @ronag

@ronag ronag merged commit 8549a94 into nodejs:main Aug 19, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
* fix: support `ArrayBufferView` and `ArrayBuffer` as body

* test: ArrayBufferView as Request.body
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* fix: support `ArrayBufferView` and `ArrayBuffer` as body

* test: ArrayBufferView as Request.body
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.

None yet

5 participants