From 240a992553ade34ce8a3f970d9c1c21eebd6ff85 Mon Sep 17 00:00:00 2001 From: rolandboon Date: Fri, 28 Sep 2012 12:59:59 +0300 Subject: [PATCH] Update lib/oauth.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the mismatch between the output of querystring.stringify() and this._encodeData().  --- lib/oauth.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/oauth.js b/lib/oauth.js index be3c6d6..7607ee6 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -327,7 +327,13 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke } if( (method == "POST" || method == "PUT") && ( post_body == null && extra_params != null) ) { - post_body= querystring.stringify(extra_params); + // Fix the mismatch between the output of querystring.stringify() and this._encodeData() + post_body= querystring.stringify(extra_params) + .replace(/\!/g, "%21") + .replace(/\'/g, "%27") + .replace(/\(/g, "%28") + .replace(/\)/g, "%29") + .replace(/\*/g, "%2A"); } headers["Content-length"]= post_body ? Buffer.byteLength(post_body) : 0;