From dac622fc46387e90167584a0fbf29a2f02189b4c Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 7 Apr 2025 12:46:28 +0200 Subject: [PATCH] browser: assume no-content type is html --- src/browser/browser.zig | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/browser/browser.zig b/src/browser/browser.zig index aca19d5e..61a5b58a 100644 --- a/src/browser/browser.zig +++ b/src/browser/browser.zig @@ -395,11 +395,15 @@ pub const Page = struct { log.info("GET {any} {d}", .{ self.uri, header.status }); - const ct = header.get("content-type") orelse { - // no content type in HTTP headers. - // TODO try to sniff mime type from the body. - log.info("no content-type HTTP header", .{}); - return; + const ct = blk: { + break :blk header.get("content-type") orelse { + // no content type in HTTP headers. + // TODO try to sniff mime type from the body. + log.info("no content-type HTTP header", .{}); + + // Assume it's HTML for now. + break :blk "text/html; charset=utf-8"; + }; }; log.debug("header content-type: {s}", .{ct});