Permalink
Browse files

Allow extraParams in signUrl and authHeader

  • Loading branch information...
chbrown committed Aug 10, 2012
1 parent a846c28 commit bd2ae9b304f77768f16b900f313ddc41aba99ca6
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/oauth.js
View
@@ -522,13 +522,17 @@ exports.OAuth.prototype.getOAuthRequestToken= function( extraParams, callback )
});
}
-exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) {
+exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method, extra_params) {
if( method === undefined ) {
var method= "GET";
}
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
+ if( extra_params === undefined ) {
+ extra_params = {};
+ }
+
+ var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);
var parsedUrl= URL.parse( url, false );
var query="";
@@ -540,11 +544,15 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query;
};
-exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method) {
+exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method, extra_params) {
if( method === undefined ) {
var method= "GET";
}
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
+ if( extra_params === undefined ) {
+ extra_params = {};
+ }
+
+ var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);
return this._buildAuthorizationHeaders(orderedParameters);
};

0 comments on commit bd2ae9b

Please sign in to comment.