Reimplemented configurable http method for token requests using setClientOptions
This commit is contained in:
@ -141,15 +141,36 @@ vows.describe('OAuth').addBatch({
|
||||
oa._performSecureRequest= function(){ return this.requestArguments = arguments; }
|
||||
return oa;
|
||||
},
|
||||
'Use the provided HTTP method': function(oa) {
|
||||
oa.getOAuthRequestToken("GET", function() {});
|
||||
'Use the HTTP method in the client options': function(oa) {
|
||||
oa.setClientOptions({ requestTokenHttpMethod: "GET" });
|
||||
oa.getOAuthRequestToken(function() {});
|
||||
assert.equal(oa.requestArguments[2], "GET");
|
||||
},
|
||||
'Use a POST by default': function(oa) {
|
||||
oa.setClientOptions({});
|
||||
oa.getOAuthRequestToken(function() {});
|
||||
assert.equal(oa.requestArguments[2], "POST");
|
||||
}
|
||||
},
|
||||
'When getting an access token': {
|
||||
topic: function() {
|
||||
var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
|
||||
oa._getTimestamp= function(){ return "1272399856"; }
|
||||
oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
|
||||
oa._performSecureRequest= function(){ return this.requestArguments = arguments; }
|
||||
return oa;
|
||||
},
|
||||
'Use the HTTP method in the client options': function(oa) {
|
||||
oa.setClientOptions({ accessTokenHttpMethod: "GET" });
|
||||
oa.getOAuthAccessToken(function() {});
|
||||
assert.equal(oa.requestArguments[2], "GET");
|
||||
},
|
||||
'Use a POST by default': function(oa) {
|
||||
oa.setClientOptions({});
|
||||
oa.getOAuthAccessToken(function() {});
|
||||
assert.equal(oa.requestArguments[2], "POST");
|
||||
}
|
||||
},
|
||||
'When get authorization header' : {
|
||||
topic: function() {
|
||||
var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
|
||||
|
Reference in New Issue
Block a user