diff --git a/lib/oauth.js b/lib/oauth.js index 50dccf99..be396ff4 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -37,6 +37,12 @@ exports.OAuth= function(requestUrl, accessUrl, consumerKey, consumerSecret, vers this._oauthParameterSeperator = ","; }; +// Allows you to set an agent to use instead of the default HTTP or +// HTTPS agents. Useful when dealing with your own certificates. +exports.OAuth.prototype.setAgent = function(agent) { + this._agent = agent; +}; + exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) { this._isEcho = true; @@ -247,6 +253,12 @@ exports.OAuth.prototype._createClient= function( port, hostname, method, path, h method: method, headers: headers }; + + //set the agent on the request options + if (this._agent) { + options.agent = this._agent; + } + var httpModel; if( sslEnabled ) { httpModel= https;