Parse the json results before making the callback. #79

Open
wants to merge 1 commit into
from
View
@@ -67,6 +67,8 @@ exports.OAuth2.prototype._request= function(method, url, headers, post_body, acc
if( response.statusCode != 200 && (response.statusCode != 301) && (response.statusCode != 302) ) {
callback({ statusCode: response.statusCode, data: result });
} else {
+ if (response.headers['content-type'].toLowerCase().indexOf('json') > 0)
+ result = JSON.parse(result);
callback(null, result, response);
}
}