Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow Buffers to be passed as post body, essential when POSTing binary data and other long chunks of data. #72

wants to merge 1 commit into


None yet
3 participants

Rendez commented Oct 19, 2011

New way of calculating post_body length when a Buffer is passed instead of a String

Rendez commented Oct 24, 2011

Content-Type gets calculated using Buffer.byteLength, which won't work if the passed data is in any way binary. data.length should be used instead.

Would you consider mergin this?

this is a great first step and seemingly required for multipart support. unfortunately it inadvertently forces the content-type to be urlencoded:

exports.OAuth.prototype._putOrPost= function(method, url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) {
  if( typeof post_body != "string" ) {
    post_content_type= "application/x-www-form-urlencoded"
    extra_params= post_body;
    post_body= null;

should the conditional exclude multipart explicitly?

  if( typeof post_body != "string" && post_content_type.toLowerCase().slice(0, 'multipart/form-data'.length) != 'multipart/form-data' ) {

i created a branch for multipart support and made the proposed change: pizthewiz/node-oauth@d9bbbf4

@tcr tcr referenced this pull request in tcr/rem Dec 24, 2012


Handle multipart form data #67

jerbob92 pushed a commit to jerbob92/hallway-original that referenced this pull request Nov 10, 2013

Share photos to Twitter; switch to mikeal/request
The OAuth library in our twitter client doesn't handle Multipart POSTs. There's
a [pull request](ciaranj/node-oauth#72) out to help, but
I couldn't get it working after the patches and we've have to check the module
in anyway.

Now `twitter/posting` consistently uses mikeal/request, which handles OAuth but
also does Multipart well, and `/types/photos` can accept an image for Twitter.

ciaranj commented May 21, 2014

Fixed (I think) in Merge #144

@ciaranj ciaranj closed this May 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment