diff --git a/lib/oauth.js b/lib/oauth.js index 50dccf99..6557dc33 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -308,7 +308,7 @@ exports.OAuth.prototype._prepareParameters= function( oauth_token, oauth_token_s exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) { var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params); - if( !post_content_type ) { + if( !post_content_type && (method == "POST" || method == "PUT")) { post_content_type= "application/x-www-form-urlencoded"; } var parsedUrl= URL.parse( url, false ); @@ -359,7 +359,9 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke headers["Content-length"]= 0; } - headers["Content-Type"]= post_content_type; + if( post_content_type ) { + headers["Content-Type"]= post_content_type; + } var path; if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/";