Esempio n. 1
0
DialogPrototype.url = function(path) {
  var self = this;
  if(URL.isRelative(path)) {
    path = this.options.base + path;
  }
  var query = {};
  this.params.forEach(function(key) {
    if(self.dialogOptions[key]) {
      query[key] = self.dialogOptions[key];
    }
  });
  query.state = this.id;
  path += '?'+qs.stringify(query);
  return path;
};
Esempio n. 2
0
APIPrototype.requestUrl = function(path, query) {
  if(URL.isRelative(path)) {
    path = this.base + path;
  }
  var loc = URL.parse(path);

  if(loc.query) {
    loc.query = qs.parse(loc.query);
  } else {
    loc.query = {};
  }
  query = query || {};
  Object.keys(query).forEach(function(key) {
    loc.query[key] = query[key];
  });

  var token = this.sdk.accessToken();
  if(!token && this.options.client_id) {
    loc.query['client_id'] = this.options.client_id;
  }
  console.log("Parsed api request url",loc);
  return loc;
}
Esempio n. 3
0
 it('should support //', function(){
   assert(false === url.isRelative('//foo.com'));
 })
Esempio n. 4
0
 it('should support relative', function(){
   assert(true === url.isRelative('foo'));
   assert(true === url.isRelative('foo/bar/baz'));
   assert(true === url.isRelative('/foo/bar/baz'));
   assert(true === url.isRelative('foo.com/something'));
 })
Esempio n. 5
0
 it('should support scheme://', function(){
   assert(false === url.isRelative('http://foo.com'));
 })