Adding cross-browser XMLHttpRequest functionality and convenience methods around it in the OpenLayers.Request namespace. Deprecating OpenLayers.Ajax.Request. Full support sync/async requests using all HTTP verbs now. r=elemoine (closes #1565)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7335 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+15
-7
@@ -4,13 +4,21 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_Ajax_loadUrl(t) {
|
||||
t.plan(1);
|
||||
var req = OpenLayers.Ajax.Request;
|
||||
OpenLayers.ProxyHost = "/?url=";
|
||||
OpenLayers.Ajax.Request.prototype.request = function(uri) {
|
||||
t.eq(uri, "/?url=http%3A%2F%2Fexample.com%2F%3Fformat%3Dimage%2Bkml", "URI matches what we expect from loadurl");
|
||||
}
|
||||
OpenLayers.loadURL("http://example.com/?format=image+kml");
|
||||
t.plan(5);
|
||||
var _get = OpenLayers.Request.GET;
|
||||
var caller = {};
|
||||
var onComplete = function() {};
|
||||
var onFailure = function() {};
|
||||
var params = {};
|
||||
OpenLayers.Request.GET = function(config) {
|
||||
t.eq(config.url, "http://example.com/?format=image+kml", "correct url")
|
||||
t.eq(config.params, params, "correct params");
|
||||
t.eq(config.scope, caller, "correct scope");
|
||||
t.ok(config.success === onComplete, "correct success callback");
|
||||
t.ok(config.failure === onFailure, "correct failure callback");
|
||||
};
|
||||
OpenLayers.loadURL("http://example.com/?format=image+kml", params, caller, onComplete, onFailure);
|
||||
OpenLayers.Request.GET = _get;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user