make sure parameter name lookups are case-insensitive

This commit is contained in:
Bart van den Eijnden
2013-11-19 17:09:02 +01:00
parent ac730dc1f3
commit bb53087541
2 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
goog.provide('ol.source.WMSGetFeatureInfoMethod');
goog.provide('ol.source.wms');
goog.require('goog.Uri');
goog.require('goog.net.XhrIo');
goog.require('goog.object');
goog.require('goog.uri.utils');
@@ -95,12 +96,11 @@ ol.source.wms.getFeatureInfo =
goog.object.extend(params, {'X': x, 'Y': y});
}
goog.object.extend(params, localOptions.params);
var uri = new goog.Uri(url, true);
for (var key in params) {
if (goog.uri.utils.hasParam(url, key)) {
url = goog.uri.utils.removeParam(url, key);
}
uri.setParameterValue(key, params[key]);
}
url = goog.uri.utils.appendParamsFromMap(url, params);
url = uri.toString();
if (localOptions.method == ol.source.WMSGetFeatureInfoMethod.IFRAME) {
goog.global.setTimeout(function() {
success('<iframe seamless src="' + url + '"></iframe>');

View File

@@ -32,8 +32,8 @@ describe('ol.source.wms', function() {
[5, 10], {params: {'INFO_FORMAT': 'text/plain'}},
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"></iframe>');
'?request=GetFeatureInfo&version=1.3&layers=foo&query_layers=' +
'foo&info_format=text%2Fplain&i=5&j=10"></iframe>');
done();
});
});
@@ -47,12 +47,12 @@ describe('ol.source.wms', function() {
});
it('overrides any existing parameters', function(done) {
ol.source.wms.getFeatureInfo('?REQUEST=GetMap&VERSION=1.3&LAYERS=' +
'foo&STYLES=x',
'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>');
'?request=GetFeatureInfo&version=1.3&layers=foo&query_layers=' +
'foo&styles=y&info_format=text%2Fplain&i=5&j=10"></iframe>');
done();
});
});