Handle empty arguments when computing the OAuth base string

This commit is contained in:
Tom Hughes 2013-04-29 10:49:19 +01:00
parent 0d35a10a50
commit d9d8d5a106

View file

@ -16,7 +16,9 @@ ohauth.qsString = function(obj) {
};
ohauth.stringQs = function(str) {
return str.split('&').reduce(function(obj, pair){
return str.split('&').filter(function (pair) {
return pair !== '';
}).reduce(function(obj, pair){
var parts = pair.split('=');
obj[decodeURIComponent(parts[0])] = (null === parts[1]) ?
'' : decodeURIComponent(parts[1]);