Skip to content

Commit

Permalink
updating lines 71 & 75 to read exports.property rather than oauth as …
Browse files Browse the repository at this point in the history
…per authors request
  • Loading branch information
sunwukung committed Jun 29, 2013
1 parent 4d1ab8c commit c409d9e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/oauth.js
Expand Up @@ -42,7 +42,7 @@ exports.merge = function(a,b) {
if (!b || !(b instanceof Object)) {
return a;
}

var keys = Object.keys(b);

for (var key in keys) {
Expand All @@ -68,11 +68,11 @@ exports.normalize = function(obj)
if (obj[prop].constructor === Array) {
obj[prop] = obj[prop].sort();
for(var child in obj[prop]) {
prop[child] = oauth.normalize(child);
prop[child] = exports.normalize(child);
}
}
else if (obj[prop] instanceof Object) {
obj[prop] = oauth.normalize(obj[prop]);
obj[prop] = exports.normalize(obj[prop]);
}
}
return obj;
Expand All @@ -96,7 +96,7 @@ exports.normalizeURL = function(path) {
slashes: true
};

if ((p.port == 80 && p.protocol == 'http:') ||
if ((p.port == 80 && p.protocol == 'http:') ||
(p.port == 443 && p.protocol == 'https:')) {
delete ret.port;
}
Expand Down Expand Up @@ -127,7 +127,7 @@ exports.request = function(options, callback) {
}

var uri = exports.fillURL(options.path, options.host, options.port, options.https);
options.headers = signRequest(options.method, uri, options.headers,
options.headers = signRequest(options.method, uri, options.headers,
options.body, options.oauth_signature, options.realm);

var req;
Expand All @@ -136,15 +136,15 @@ exports.request = function(options, callback) {
} else {
req = http.request(options, callback);
}

req.write = function(chunk, normalize) {
if (normalize || options.body) {
chunk = normalizeBody(chunk);
}

return http.ClientRequest.prototype.write.call(this, chunk, 'utf-8');
};

req.end();
return req;
};
Expand Down Expand Up @@ -192,7 +192,7 @@ function signRequest(method, path, headers, body, signature, realm) {
else {
throw new TypeError("Invalid signature type");
}

var esc = querystring.escape;
querystring.escape = _encodeURI;
auth.realm = realm;
Expand All @@ -203,7 +203,7 @@ function signRequest(method, path, headers, body, signature, realm) {
return headers;
}

exports.signRequest = signRequest;
exports.signRequest = signRequest;

function nonce() {
return uuid();
Expand Down Expand Up @@ -312,13 +312,13 @@ Signature.prototype.sign = function() {
Signature.prototype.baseString = function(method, url, params) {

querystring.escape = _encodeURI;

var baseString = [
method.toUpperCase(),
_encodeURI(exports.normalizeURL(url)),
_encodeURI(querystring.stringify(exports.normalize(params)))
].join('&');

return baseString;
};

Expand Down

0 comments on commit c409d9e

Please sign in to comment.