Fix for "extra '?' is added to the URL by the LoadURL method", review and final patch from tschaub (closes #1616)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7984 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-09-09 06:55:19 +00:00
parent 30ab46f265
commit 4cf8b53027
2 changed files with 42 additions and 3 deletions

View File

@@ -87,7 +87,11 @@ OpenLayers.Request = {
var request = new OpenLayers.Request.XMLHttpRequest();
var url = config.url;
if(config.params) {
url += "?" + OpenLayers.Util.getParameterString(config.params);
var paramString = OpenLayers.Util.getParameterString(config.params);
if(paramString.length > 0) {
var separator = (url.indexOf('?') > -1) ? '&' : '?';
url += separator + paramString;
}
}
if(config.proxy && (url.indexOf("http") == 0)) {
url = config.proxy + encodeURIComponent(url);
@@ -265,4 +269,4 @@ OpenLayers.Request = {
return OpenLayers.Request.issue(config);
}
};
};