@@ -756,8 +756,10 @@ pub const XMLHttpRequest = struct {
756756 // https://xhr.spec.whatwg.org/#the-response-attribute
757757 pub fn get_response (self : * XMLHttpRequest , alloc : std.mem.Allocator ) ! ? Response {
758758 if (self .response_type == .Empty or self .response_type == .Text ) {
759- if (self .state == LOADING or self .state == DONE ) return .{ .Text = "" };
760- return .{ .Text = try self .get_responseText () };
759+ if (self .state == LOADING or self .state == DONE ) {
760+ return .{ .Text = try self .get_responseText () };
761+ }
762+ return .{ .Text = "" };
761763 }
762764
763765 // fastpath if response is previously parsed.
@@ -774,6 +776,7 @@ pub const XMLHttpRequest = struct {
774776 // response object to a new ArrayBuffer object representing this’s
775777 // received bytes. If this throws an exception, then set this’s
776778 // response object to failure and return null.
779+ log .err ("response type ArrayBuffer not implemented" , .{});
777780 return null ;
778781 }
779782
@@ -782,6 +785,7 @@ pub const XMLHttpRequest = struct {
782785 // response object to a new Blob object representing this’s
783786 // received bytes with type set to the result of get a final MIME
784787 // type for this.
788+ log .err ("response type Blob not implemented" , .{});
785789 return null ;
786790 }
787791
@@ -944,7 +948,7 @@ pub fn testExecFn(
944948 .{ .src = "req.getResponseHeader('Content-Type')" , .ex = "text/html; charset=utf-8" },
945949 .{ .src = "req.getAllResponseHeaders().length > 64" , .ex = "true" },
946950 .{ .src = "req.responseText.length > 64" , .ex = "true" },
947- .{ .src = "req.response" , .ex = "" },
951+ .{ .src = "req.response.length == req.responseText.length " , .ex = "true " },
948952 .{ .src = "req.responseXML instanceof Document" , .ex = "true" },
949953 };
950954 try checkCases (js_env , & send );
0 commit comments