How to use the @esri/arcgis-rest-request.encodeQueryString function in @esri/arcgis-rest-request

To help you get started, we’ve selected a few @esri/arcgis-rest-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / esri-leaflet / src / Request.js View on Github external
export function request (url, params, callback, context) {
  var paramString = encodeQueryString(params);
  var requestLength = (url + '?' + paramString).length;

  // to do: https://github.com/Esri/arcgis-rest-js/issues/114
  // if (typeof context !== 'undefined' && context !== null) {
  //   if (typeof context.options !== 'undefined') {
  //     httpRequest.timeout = context.options.timeout;
  //   }
  // }

  if (requestLength <= 2000 && Support.cors) {
    this.get(url, params, callback, context);
    return;
  } else if (requestLength > 2000 && Support.cors) {
    this.post(url, params, callback, context);
    return;
  }
github Esri / esri-leaflet / src / Request.js View on Github external
response = null;
      }

      if (!error && response.error) {
        error = response;
        response = null;
      }

      callback.call(context, error, response);
      window._EsriLeafletCallbacks[callbackId] = true;
    }
  };

  var script = DomUtil.create('script', null, document.body);
  script.type = 'text/javascript';
  script.src = url + '?' + encodeQueryString(params);
  script.id = callbackId;
  DomUtil.addClass(script, 'esri-leaflet-jsonp');

  callbacks++;

  return {
    id: callbackId,
    url: script.src,
    abort: function () {
      window._EsriLeafletCallbacks._callback[callbackId]({
        code: 0,
        message: 'Request aborted.'
      });
    }
  };
}