From 8d9ee8ee4f24f3f9c3577cda80b142a93890e16c Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 13 Dec 2024 14:02:12 +0100 Subject: [PATCH] Update getfeatureinfo.js --- src/getfeatureinfo.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/getfeatureinfo.js b/src/getfeatureinfo.js index e57d678b2..8bebaa568 100644 --- a/src/getfeatureinfo.js +++ b/src/getfeatureinfo.js @@ -13,7 +13,7 @@ const isValidJSON = str => { return false; } }; - + /** * Factory method to create a SelectedItem instance. Note that this method is exposed in api. * Does not add async content (related tables and attachments). If you need async content use @@ -143,8 +143,8 @@ async function getFeatureInfoUrl({ } if (layer.get('infoFormat') === 'application/geo+json' || layer.get('infoFormat') === 'application/geojson') { - let format = layer.get('infoFormat'); - let formatArr = [...new Set([format, 'application/geo+json', 'application/geojson', 'application/json'])]; + const format = layer.get('infoFormat'); + const formatArr = [...new Set([format, 'application/geo+json', 'application/geojson', 'application/json'])]; let text; for (const f of formatArr) { const url = layer.getSource().getFeatureInfoUrl(coordinate, resolution, projection, { @@ -153,11 +153,11 @@ async function getFeatureInfoUrl({ }); const res = await fetch(url, { method: 'GET' }); text = await res.text(); - if(isValidJSON(text)){ + if (isValidJSON(text)) { layer.set('infoFormat', f); break; } - }; + } let json = {}; try { json = JSON.parse(text);