From 3be822f9266bc36bf8a003cc9f056fdf63d7f5c6 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 28 Feb 2023 08:53:54 +0000 Subject: [PATCH] Fix interpretation of HTTP status codes --- core/modules/utils/dom/http.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 8a1fbb27f..b654b24dc 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -74,14 +74,15 @@ HttpClient.prototype.handleHttpRequest = function(event) { headers: requestHeaders, data: paramObject.body, 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) { var pos = line.indexOf(":"); if(pos !== -1) { headers[line.substr(0,pos)] = line.substr(pos + 1).trim(); } }); - setBinding(bindStatus,xhr.status === 200 ? "complete" : "error"); + setBinding(bindStatus,success); setBinding(bindProgress,"100"); var results = { status: xhr.status.toString(),