Ignore:
Timestamp:
May 23, 2017, 1:54:31 PM (5 years ago)
Author:
djay
Message:

Add support for headers definition to requests run from js ZOO-API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-api/js/ZOO-api.js

    r625 r828  
    436436   * url - {String} The URL to request.
    437437   * params - {Object} Params to add to the url
     438   * headers - {Object/Array}  A key-value object of headers
    438439   *
    439440   * Returns:
    440441   * {String} Request result.
    441442   */
    442   Get: function(url,params) {
     443    Get: function(url,params,headers) {
    443444    var paramsArray = [];
    444445    for (var key in params) {
     
    466467      url += separator + paramString;
    467468    }
    468     return ZOORequest('GET',url);
     469    if(!(headers instanceof Array)) {
     470        var headersArray = [];
     471        for (var name in headers) {
     472            headersArray.push(name+': '+headers[name]);
     473        }
     474        headers = headersArray;
     475    }
     476    return ZOORequest('GET',url,headers);
    469477  },
    470478  /**
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png