browser: assume no-content type is html

This commit is contained in:
Pierre Tachoire
2025-04-07 12:46:28 +02:00
parent 92e2daf056
commit dac622fc46

View File

@@ -395,11 +395,15 @@ pub const Page = struct {
log.info("GET {any} {d}", .{ self.uri, header.status }); log.info("GET {any} {d}", .{ self.uri, header.status });
const ct = header.get("content-type") orelse { const ct = blk: {
// no content type in HTTP headers. break :blk header.get("content-type") orelse {
// TODO try to sniff mime type from the body. // no content type in HTTP headers.
log.info("no content-type HTTP header", .{}); // TODO try to sniff mime type from the body.
return; 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}); log.debug("header content-type: {s}", .{ct});