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 for allowing POST request with formdata-node using response.body stream as body #1719

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

4miners
Copy link

@4miners 4miners commented Feb 24, 2023

Purpose

It should be possible to use response.body of one fetch request as the source body for the second fetch request, using formdata-node. This allows downloading file from one remote server and uploading it, as it's downloaded, to another remote server (on-the-fly, without writing to disc). This was not possible due to a Cannot perform Construct on a detached ArrayBuffer error.

Changes

  • Copy the buffer when setting previousChunk instead of passing it by reference.
  • Enhance TestServer instance to allow new test cases.
  • Added should allow POST request with formdata-node using response.body stream as body test case.

Additional information


  • I added test(s)

Copy link

@jsmonkey jsmonkey left a comment

Choose a reason for hiding this comment

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

Looks good!

@lorenzopolidori
Copy link

@4miners What is the timeline for this PR to be merged and this fix being released?

@4miners
Copy link
Author

4miners commented Mar 31, 2023

@lorenzopolidori Sorry, it's hard to tell because I'm only a contributor, not a repository maintainer.

@Maxou44
Copy link

Maxou44 commented Jan 16, 2024

Can someone merge this fix ?

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.

Sending response.body using formdata-node fails due to Buffer reference
4 participants