Skip to content

Commit

Permalink
Merge pull request #882 from jgravois/patch876
Browse files Browse the repository at this point in the history
don't ask utility.arcgis.com services for geojson
  • Loading branch information
patrickarlt authored Nov 14, 2016
2 parents 20d7d98 + 5b9da5d commit 9639554
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions spec/Tasks/QuerySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,5 +775,21 @@ describe('L.esri.Query', function () {

server.respond();
});

it('should not ask for GeoJSON from utility.arcgis.com', function (done) {
task = L.esri.query({url: 'http://utility.arcgis.com/mock/arcgis/rest/services/MockFeatureService/FeatureServer/0/'});

server.respondWith('GET', 'http://utility.arcgis.com/mock/arcgis/rest/services/MockFeatureService/FeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleMapServiceQueryResponse));

var request = task.run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleMapServiceCollection);
expect(raw).to.deep.equal(sampleMapServiceQueryResponse);
done();
});

expect(request).to.be.an.instanceof(XMLHttpRequest);

server.respond();
});
});
/* eslint-enable handle-callback-err*/
5 changes: 3 additions & 2 deletions src/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ export function cleanUrl (url) {
}

export function isArcgisOnline (url) {
/* hosted feature services can emit geojson natively. */
return (/\.arcgis\.com.*?FeatureServer/g).test(url);
/* hosted feature services support geojson as an output format
utility.arcgis.com services are proxied from a variety of ArcGIS Server vintages, and may not */
return (/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i).test(url);
}

export function geojsonTypeToArcGIS (geoJsonType) {
Expand Down

0 comments on commit 9639554

Please sign in to comment.