Permalink
Browse files

Merge pull request #114 from rolandboon/master

Fix requests containing !'()* in POST data
  • Loading branch information...
ciaranj committed Nov 25, 2012
2 parents 282733a + 240a992 commit 45a983e6dc059f8283da646bf33dec37a46c4aa3
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/oauth.js
View
@@ -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;

1 comment on commit 45a983e

@tomasikp

This comment has been minimized.

Show comment Hide comment
@tomasikp

tomasikp Dec 11, 2012

bump version?

bump version?

Please sign in to comment.