make tests pass in the test runner as well by not checking for status code
This commit is contained in:
+10
-13
@@ -2,26 +2,23 @@
|
|||||||
(function(global) {
|
(function(global) {
|
||||||
|
|
||||||
function afterLoad(type, path, next) {
|
function afterLoad(type, path, next) {
|
||||||
var xhr = new XMLHttpRequest();
|
var client = new XMLHttpRequest();
|
||||||
xhr.open('GET', path, true);
|
client.open('GET', path, true);
|
||||||
xhr.onload = function() {
|
client.onload = function() {
|
||||||
var data;
|
var data;
|
||||||
if (xhr.status == 200) {
|
if (type === 'xml') {
|
||||||
if (type === 'xml') {
|
data = client.responseXML;
|
||||||
data = xhr.responseXML;
|
|
||||||
} else {
|
|
||||||
data = xhr.responseText;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(path + ' loading failed: ' + xhr.status);
|
data = client.responseText;
|
||||||
|
}
|
||||||
|
if (!data) {
|
||||||
|
throw new Error(path + ' loading failed: ' + client.status);
|
||||||
}
|
}
|
||||||
next(data);
|
next(data);
|
||||||
xhr = null;
|
|
||||||
};
|
};
|
||||||
xhr.send();
|
client.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path Relative path to file (e.g. 'spec/ol/foo.json').
|
* @param {string} path Relative path to file (e.g. 'spec/ol/foo.json').
|
||||||
* @param {function(Object)} next Function to call with response object on
|
* @param {function(Object)} next Function to call with response object on
|
||||||
|
|||||||
Reference in New Issue
Block a user