diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1.js b/lib/OpenLayers/Format/WMSCapabilities/v1.js index 08af526ff9..b715bfd6e8 100644 --- a/lib/OpenLayers/Format/WMSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WMSCapabilities/v1.js @@ -305,15 +305,22 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class( "Get": function(node, obj) { obj.get = {}; this.readChildNodes(node, obj.get); + // backwards compatibility + if (!obj.href) { + obj.href = obj.get.href; + } }, "Post": function(node, obj) { obj.post = {}; this.readChildNodes(node, obj.post); + // backwards compatibility + if (!obj.href) { + obj.href = obj.get.href; + } }, "GetMap": function(node, obj) { obj.getmap = {formats: []}; this.readChildNodes(node, obj.getmap); - obj.getmap.href = obj.getmap.get.href || obj.getmap.post.href; // backwards compatibility }, "GetFeatureInfo": function(node, obj) { obj.getfeatureinfo = {formats: []}; diff --git a/tests/Format/WMSCapabilities/v1_1_1.html b/tests/Format/WMSCapabilities/v1_1_1.html index f6a44d3827..8560c36f18 100644 --- a/tests/Format/WMSCapabilities/v1_1_1.html +++ b/tests/Format/WMSCapabilities/v1_1_1.html @@ -5,7 +5,7 @@ function test_read(t) { - t.plan(17); + t.plan(23); var xml = document.getElementById("gssample").firstChild.nodeValue; var doc = new OpenLayers.Format.XML().read(xml); @@ -32,6 +32,40 @@ undefined, "getmap.post not available" ); + + var describelayer = capability.request.describelayer; + t.eq( + describelayer.href, + "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&", + "describelayer href parsed" + ); + t.eq( + describelayer.get.href, + describelayer.href, + "describelayer.get.href parsed" + ); + t.eq( + describelayer.post, + undefined, + "describelayer.post not available" + ); + + var getfeatureinfo = capability.request.getfeatureinfo; + t.eq( + getfeatureinfo.href, + "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&", + "getfeatureinfo href parsed" + ); + t.eq( + getfeatureinfo.get.href, + getfeatureinfo.href, + "getmap.get.href parsed" + ); + t.eq( + getfeatureinfo.post.href, + "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&", + "getfeatureinfo.post set correctly" + ); t.ok(capability.layers, "layers parsed"); t.eq(capability.layers.length, 22, "correct number of layers parsed");