-
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
Add multipart chunked flag #1253
Conversation
This fix uploads successfully to both Couchdb and Gdrive, the first one uses |
Yeah, that is quite ugly. If I'm reading #1243 correctly, this is only an issue with servers that interpret chunked requests incorrectly? Do we know of any such servers other than CouchDB, and how hard would it be for an external caller to implement this logic themselves? If we go this route, I'd probably rather see separate options - |
I don't know of any other server having problems with it, and most of them are implementing multipart/form-data anyway. As for implementing outside of request - all the magic happens inside the multipart method, but I'm not sure if that's an option. Can we add an additional |
An additional flag option sounds fine to me. Let's call it Or, we could do this: // default, using chunked encoding (or not?)
{ multipart : [ ... ] }
// explicitly specify whether to use chunked encoding
{ multipart : {
chunked : true,
data : [ ... ]
} }
{ multipart : {
chunked : false,
data : [ ... ]
} } |
Yep, that was my initial intent by introducing an object for the Also I'm definitely for keeping the Setting Let's see what @dscape thinks about it too. |
Sounds good. I like having one option (that can be an object or an array), but having |
Agreed, let's see if anyone else have something to add, otherwise I'm going with the |
Currently the |
This looks good to me, just needs docs. |
Done, the changes in the code example are not that much, I just couldn't figure out the punctuation, also the above example is using the commas at the end of the line as well. |
Nice work as usual. Let's tweak the docs a little, do you mind pulling in my simov-multipart-chunked branch here, or giving feedback if you see any issues? |
It's definitely better, one small issue though. The default is not What was the idea, is it supposed to be true by default? |
You're right, I misread this line: var chunked = (multipart instanceof Array) || multipart.chunked I was thinking it would make sense to have |
Done. Also added a test case for it, and fixed a bug in the tests. |
Thanks @simov! |
Fixes #1243
That's just to show up the idea from my last comment. Basically I'm bringing back the code from v2.46 and I'm introducing a flag so that both implementations can exist together.
I'm proposing this syntax for non chunked/streamed multipart/related bodies
Obviously that's ugly, but I can't think of anything more reasonable at this point. Once we agree on the syntax I'll add tests for it.