From 91561e4f2f625cc9c925d734229fda5172e9ba7f Mon Sep 17 00:00:00 2001 From: ryanackley Date: Sun, 11 Sep 2016 17:07:46 -0400 Subject: [PATCH] Remove content-type from GET requests The content type is unsettable from oauth.get requests so it ends up being "application/x-www-form-urlencoded". I'm trying to access a rest endpoint and this content-type is causing a 415 error "Unsupported Media Type". --- lib/oauth.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oauth.js b/lib/oauth.js index 50dccf99..2599019d 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -358,8 +358,10 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke } else { headers["Content-length"]= 0; } - - headers["Content-Type"]= post_content_type; + + if (method != "GET"){ + headers["Content-Type"]= post_content_type; + } var path; if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/";