diff --git a/web/client/components/data/identify/Identify.jsx b/web/client/components/data/identify/Identify.jsx index c8350a6978..1d08683c2c 100644 --- a/web/client/components/data/identify/Identify.jsx +++ b/web/client/components/data/identify/Identify.jsx @@ -229,11 +229,10 @@ const Identify = React.createClass({ op[next] = layer[next]; }else if (next === "params" && excludeList.length > 0) { let params = layer[next]; - op[next] = Object.keys(params).reduce((pr, n) => { + Object.keys(params).forEach((n) => { if (excludeList.findIndex((el) => {return (el === n); }) === -1) { - pr[n] = params[n]; + op[n] = params[n]; } - return pr; }, {}); } return op; diff --git a/web/client/components/data/identify/__tests__/Identify-test.jsx b/web/client/components/data/identify/__tests__/Identify-test.jsx index cdefc24bf9..f047bfc439 100644 --- a/web/client/components/data/identify/__tests__/Identify-test.jsx +++ b/web/client/components/data/identify/__tests__/Identify-test.jsx @@ -237,4 +237,38 @@ describe('Identify', () => { expect(dom.innerHTML.indexOf('Lat:') !== -1).toBe(true); expect(dom.innerHTML.indexOf('Long:') !== -1).toBe(true); }); + it('test options and parameters filtering', () => { + const Viewer = (props) => {props.responses.length}; + const layer = { + INTERNAL_OPTION: true, + WMS_OPTION: true, + params: { + ONLY_GETMAP: true, + WMS_PARAMETER_TO_SHARE: true + }}; + const identify = ReactDOM.render( + true} + point={{latlng: {lat: 40, lng: 10}}} + viewer={Viewer} + enabled={true} + layers={[layer]} + sendRequest={[{}, {}]} + buildRequest={() => ({})} + requests={[{}]} + reverseGeocodeData={{display_name: "test"}} />, + document.getElementById("container") + ); + expect(identify).toExist(); + let params = identify.filterRequestParams(layer); + expect(params).toExist(); + expect(params.ONLY_GETMAP).toNotExist(); + expect(params.INTERNAL_OPTION).toNotExist(); + expect(params.WMS_PARAMETER_TO_SHARE).toBe(true); + expect(params.WMS_OPTION).toBe(true); + + }); }); diff --git a/web/client/utils/MapInfoUtils.js b/web/client/utils/MapInfoUtils.js index 20dc9a0e09..b8758f6b7c 100644 --- a/web/client/utils/MapInfoUtils.js +++ b/web/client/utils/MapInfoUtils.js @@ -177,7 +177,7 @@ const MapInfoUtils = { bounds.maxy, feature_count: props.maxItems, info_format: props.format, - ...assign({}, layer.baseParams, props.params) + ...assign({}, layer.baseParams, layer.params, props.params) }, metadata: { title: layer.title,