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
Add support for multipart form data via the request options #925
Conversation
If the server on the endpoint does not support SSL correctly, a response.client object may not be available. Check before reading properties from response.client.
Forgot to mention in the PR, this includes tests for the new option. |
+1 For this feature! It would be awesome! |
I also prefer "formdata" to "formMPU". |
@@ -0,0 +1,77 @@ | |||
try { |
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.
This try should be removed and form-data
should be added to devDependencies.
Re naming: In my original proposal I admitted I couldn't think of a good name :) I like |
Hmm, Travis wasn't running It looks like Travis isn't calling npm install before running your tests, which is preventing a lot of test suites from running. |
Also an open question: What should happen when |
@FredKSchott there are lots of options that conflict when used together, i wouldn't worry about it too much :) |
you might wanna pull latest, the mime module was swapped for 'mime-types' and is updated in the test that is in HEAD. |
Ah, yea that was it. good catch. Alright, comments addressed, tests passing, and README updated. Should be ready for final review / merge. Let me know if you need anything else, and feel free to edit the README if you'd rather explain the new option yourself. |
"optionalDependencies": { | ||
"tough-cookie": ">=0.12.0", | ||
"form-data": "~0.1.0", |
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.
You know what, this should actually be a regular ol' dependency. I'm just not sold anymore on the optionalDependency thing, and making it a devDependency was not correct, that's my bad, I apologize :)
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.
No worries, I didn't even think about it either when I made the change
one last comment/change cause I was wrong about the devDep :) |
@mikeal would you be open to porting the test suite to mocha or similar? |
comment addressed |
…ed or false otherwise
[fixes request#1023] Set self._ended to true once response has ended
Added allowRedirect function. Should return true if redirect is allowed or false otherwise
This no longer merges cleanly and I think it refers to an old version of form data. Sorry this got lost in the pile would, love a clean PR though :) |
Checking for SSL fault on connection before reading SSL properties
yea there's some wierdness going on here, I cleaned it up on my local repo but every pull request keeps including these other commits. I can't seem to fix it so I'll just keep it closed. @crocket's PR looks fine, feel free to merge his instead. |
(See original proposal here #924)
Summary
Instead of creating your own form for multipart uploads and having to append data separately, pass the data you'd like to attach via the request options argument. For more advanced cases where the third append argument is required, the current solution can still be used.
Before
After