Browse files

Update lib/oauth.js

Fix the mismatch between the output of querystring.stringify() and this._encodeData(). 
  • Loading branch information...
1 parent a846c28 commit 240a992553ade34ce8a3f970d9c1c21eebd6ff85 @rolandboon rolandboon committed Sep 28, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/oauth.js
View
8 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;

0 comments on commit 240a992

Please sign in to comment.