-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Stream multipart/related bodies #1185
Conversation
+1 @simov this is great. Can you add some tests to make sure this doesn't break in the future? |
Done. I just copied the form-data test, because the they are very similar. Also added a small fix to not modify the application level object |
{name: 'my_field', body: 'my_value'}, | ||
{name: 'my_buffer', body: new Buffer([1, 2, 3])}, | ||
{name: 'my_file', body: fs.createReadStream(localFile)}, | ||
{name: 'remote_file', body: request(remoteFile)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we already test that request behaves like a read stream elsewhere, this seems unnecessary. Since it now adds a dependency on the nodejs website (if the websites down, our tests don't pass) I'd say we should remove this remote_file
test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you copied this from test-form, can you remove it there as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remote_file
is used in the form-data test to show that the form-data module sets the name of the file properly inside the multipart body, which is required in some cases when using multipart/form-data
uploads
As for the multipart/related
test it doesn't really matter, as long as it's a stream it should work
Can we make the test server itself serves some image, and make request to it inside the test
Awesome, +1 from me! (/w a small comment unrelated to the work itself) |
Done. Btw if the server doesn't return |
Btw what happened with this one? Is it good to go, or something is missing? |
We have a 👍 from @FredKSchott, but there's a merge conflict now. If you can resolve the conflict then one of us will merge it. |
…m-multipart-related Conflicts: request.js
Fixed |
Awesome, merging now |
Stream multipart/related bodies
👋
Related to this one #1181
My test case
Basically I'm using the same module that form-data uses internally - https://github.com/felixge/node-combined-stream
Google implements their
multipart/related
support in much the same way, using multipart-stream which in turn uses sandwich-stream