mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
Handle response without body
This commit is contained in:
@@ -695,6 +695,18 @@ 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 = {} };
|
||||
|
||||
var fbs = std.io.fixedBufferStream("");
|
||||
const html_doc = try parser.documentHTMLParse(fbs.reader(), "utf-8");
|
||||
try self.setDocument(html_doc);
|
||||
|
||||
self.documentIsComplete();
|
||||
},
|
||||
.raw => |buf| {
|
||||
self.mode = .{ .raw_done = buf.items };
|
||||
self.documentIsComplete();
|
||||
|
||||
Reference in New Issue
Block a user