Skip to content

Commit

Permalink
Avoid some duplicate parameters in GetLegendGraphics requests
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Sep 30, 2024
1 parent 756c66e commit f8fd74e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/LayerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ const LayerUtils = {
return externalLayer.legendUrl || "";
}
const urlParts = url.parse(externalLayer.legendUrl, true);
urlParts.query = Object.keys(urlParts.query).filter(key => {
// Filter service, request, version
return !["service", "request", "version"].includes(key.toLowerCase());
}).reduce((res, key) => ({...res, [key]: urlParts.query[key]}), {});
urlParts.query = {
VERSION: layer.version,
...urlParts.query,
Expand All @@ -762,6 +766,10 @@ const LayerUtils = {
const layername = layer === sublayer ? layer.params.LAYERS.split(",").reverse().join(",") : sublayer.name;
const style = layer === sublayer ? layer.params.STYLES.split(",").reverse().join(",") : sublayer.style;
const urlParts = url.parse(layer.legendUrl, true);
urlParts.query = Object.keys(urlParts.query).filter(key => {
// Filter service, request, version
return !["service", "request", "version"].includes(key.toLowerCase());
}).reduce((res, key) => ({...res, [key]: urlParts.query[key]}), {});
urlParts.query = {
VERSION: layer.version,
...urlParts.query,
Expand Down

0 comments on commit f8fd74e

Please sign in to comment.