2
0
Fork 0

Added json accept header on resouces fetch

This commit is contained in:
Willem 2016-03-14 00:26:00 +01:00
parent efff34774e
commit 7a2f9bf7ad
2 changed files with 9 additions and 5 deletions

View file

@ -216,10 +216,11 @@ Add unit tests for any new or changed functionality. Lint and test your code.
### 0.2.0
* Moved error.style and question.style to css file.
* Change dist with extra css/js folder.
* Changed dist with extra css/js folder.
* Added loader progress bar.
* refined css so question/loader/error are equal.
* Added response header check support.
* Added json accept header on assets resources list.
### 0.1.1
* Moved websql delete timeout to cleanServerlUrl for faster boot.

View file

@ -26,7 +26,7 @@
/**
* FFSpaLoader is an assets loader for single page applications.
* Its build around the concept the there is only a single static index.html which
* synces all its assets to local cache for offline and or fast page loads.
* synces all its assets to local cache for offline use and or fast page loads.
*
* @module FFSpaLoader
*/
@ -330,7 +330,7 @@
* @param {function} cb Error first callback when done.
* @private
*/
var utilHttpFetch = function (url, cb) {
var utilHttpFetch = function (url, cb, onlyJson) {
var startTime = new Date().getTime();
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
@ -369,6 +369,9 @@
var headerValue = options.server.header.request[headerKey];
httpRequest.setRequestHeader(headerKey,headerValue);
}
if (onlyJson === true) {
httpRequest.setRequestHeader('Accept','application/json');
}
httpRequest.send();
};
@ -783,7 +786,7 @@
progressBar.done();
});
}
});
}, true);
};
/**
@ -857,7 +860,7 @@
} else {
startLoader(clearUi);
}
});
}, true);
};
/**