Compare commits

...

3 Commits

Author SHA1 Message Date
buggyj b28d2f098b
Merge f9cec3a7d2 into a081e58273 2024-04-25 23:52:22 +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
buggyj f9cec3a7d2 Fixes #8092 SelectWidget does not work with multiple options organised into group 2024-03-19 19:08:05 +01:00
2 changed files with 11 additions and 2 deletions

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;

View File

@ -122,8 +122,17 @@ SelectWidget.prototype.setSelectValue = function() {
value = value === undefined ? "" : value;
var select = this.getSelectDomNode();
var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
var child;
for(var i=0; i < select.children.length; i++){
select.children[i].selected = values.indexOf(select.children[i].value) !== -1
child=select.children[i];
if (child.children.length === 0){
child.selected = values.indexOf(child.value) !== -1
} else {
// grouped options
for(var y=0; y < child.children.length; y++){
child.children[y].selected = values.indexOf(child.children[y].value) !== -1
}
}
}
} else {
var domNode = this.getSelectDomNode();