mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-12 18:30:27 +00:00
Fix interpretation of HTTP status codes
This commit is contained in:
parent
9700030d12
commit
3be822f926
@ -74,14 +74,15 @@ HttpClient.prototype.handleHttpRequest = function(event) {
|
|||||||
headers: requestHeaders,
|
headers: requestHeaders,
|
||||||
data: paramObject.body,
|
data: paramObject.body,
|
||||||
callback: function(err,data,xhr) {
|
callback: function(err,data,xhr) {
|
||||||
var headers = {};
|
var success = (xhr.status >= 200 || xhr.status < 300) ? "complete" : "error",
|
||||||
|
headers = {};
|
||||||
$tw.utils.each(xhr.getAllResponseHeaders().split("\r\n"),function(line) {
|
$tw.utils.each(xhr.getAllResponseHeaders().split("\r\n"),function(line) {
|
||||||
var pos = line.indexOf(":");
|
var pos = line.indexOf(":");
|
||||||
if(pos !== -1) {
|
if(pos !== -1) {
|
||||||
headers[line.substr(0,pos)] = line.substr(pos + 1).trim();
|
headers[line.substr(0,pos)] = line.substr(pos + 1).trim();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setBinding(bindStatus,xhr.status === 200 ? "complete" : "error");
|
setBinding(bindStatus,success);
|
||||||
setBinding(bindProgress,"100");
|
setBinding(bindProgress,"100");
|
||||||
var results = {
|
var results = {
|
||||||
status: xhr.status.toString(),
|
status: xhr.status.toString(),
|
||||||
|
Loading…
Reference in New Issue
Block a user