override URL parameter values in the GetFeatureInfo request if someone provides a param in getFeatureInfoOptions with the same name
This commit is contained in:
@@ -95,6 +95,11 @@ ol.source.wms.getFeatureInfo =
|
|||||||
goog.object.extend(params, {'X': x, 'Y': y});
|
goog.object.extend(params, {'X': x, 'Y': y});
|
||||||
}
|
}
|
||||||
goog.object.extend(params, localOptions.params);
|
goog.object.extend(params, localOptions.params);
|
||||||
|
for (var key in params) {
|
||||||
|
if (goog.uri.utils.hasParam(url, key)) {
|
||||||
|
url = goog.uri.utils.removeParam(url, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
url = goog.uri.utils.appendParamsFromMap(url, params);
|
url = goog.uri.utils.appendParamsFromMap(url, params);
|
||||||
if (localOptions.method == ol.source.WMSGetFeatureInfoMethod.IFRAME) {
|
if (localOptions.method == ol.source.WMSGetFeatureInfoMethod.IFRAME) {
|
||||||
goog.global.setTimeout(function() {
|
goog.global.setTimeout(function() {
|
||||||
|
|||||||
@@ -45,6 +45,17 @@ describe('ol.source.wms', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it('overrides any existing parameters', function(done) {
|
||||||
|
ol.source.wms.getFeatureInfo('?REQUEST=GetMap&VERSION=1.3&LAYERS=' +
|
||||||
|
'foo&STYLES=x',
|
||||||
|
[5, 10], {params: {'INFO_FORMAT': 'text/plain', STYLES: 'y'}},
|
||||||
|
function(info) {
|
||||||
|
expect(info).to.eql('<iframe seamless src="' +
|
||||||
|
'?REQUEST=GetFeatureInfo&VERSION=1.3&LAYERS=foo&QUERY_LAYERS=' +
|
||||||
|
'foo&INFO_FORMAT=text%2Fplain&I=5&J=10&STYLES=y"></iframe>');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user