Compare commits

...

4 Commits

Author SHA1 Message Date
lin onetwo e44cc28b31
Merge 36bf0848e0 into a081e58273 2024-04-25 23:45:41 +08:00
Matt Lauber a081e58273
HTTP Client: Return success calls for all 2XX response codes (#8150)
APIs especially use 2XX response codes outside of 200, 201, 204 for responding to responses.  Treat all "Successful" response codes (i.e. anything between 200-299) as successes, and pass the responseText.
2024-04-16 16:24:53 +01:00
lin onetwo 36bf0848e0 refactor: only import lingo macro for title to save memory 2024-03-21 17:33:05 +08:00
lin onetwo 74879e1f54 fix: import lingo macro when render title 2024-03-21 16:15:11 +08:00
2 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,11 @@ var THROTTLE_REFRESH_TIMEOUT = 400;
exports.startup = function() {
// Set up the title
$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE,{document: $tw.fakeDocument, parseAsInline: true});
$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE, {
document: $tw.fakeDocument,
parseAsInline: true,
importVariables: "[[$:/core/macros/lingo]]",
});
$tw.titleContainer = $tw.fakeDocument.createElement("div");
$tw.titleWidgetNode.render($tw.titleContainer,null);
document.title = $tw.titleContainer.textContent;

View File

@ -283,7 +283,7 @@ exports.httpRequest = function(options) {
// Set up the state change handler
request.onreadystatechange = function() {
if(this.readyState === 4) {
if(this.status === 200 || this.status === 201 || this.status === 204) {
if(this.status >= 200 && this.status < 300) {
// Success!
options.callback(null,this[returnProp],this);
return;