mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-07 03:41:34 -04:00
Merge pull request #973 from lightpanda-io/no-body-response
Handle response without body
This commit is contained in:
1 file changed
+11
-4
+11
-4
@@ -695,6 +695,17 @@ pub const Page = struct {
|
||||
self.clearTransferArena();
|
||||
|
||||
switch (self.mode) {
|
||||
.pre => {
|
||||
// Received a response without a body like: https://httpbin.io/status/200
|
||||
// We assume we have received an OK status (checked in Client.headerCallback)
|
||||
// so we load a blank document to navigate away from any prior page.
|
||||
self.mode = .{ .parsed = {} };
|
||||
|
||||
const html_doc = try parser.documentHTMLParseFromStr("");
|
||||
try self.setDocument(html_doc);
|
||||
|
||||
self.documentIsComplete();
|
||||
},
|
||||
.raw => |buf| {
|
||||
self.mode = .{ .raw_done = buf.items };
|
||||
self.documentIsComplete();
|
||||
@@ -756,10 +767,6 @@ pub const Page = struct {
|
||||
self.documentIsComplete();
|
||||
}
|
||||
},
|
||||
.pre => {
|
||||
// we didn't get any data.
|
||||
self.documentIsComplete();
|
||||
},
|
||||
else => {
|
||||
log.err(.app, "unreachable mode", .{ .mode = self.mode });
|
||||
unreachable;
|
||||
|
||||
Reference in new issue
Block a user