mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Try to sniff the mime type based on the body content
Synchronous body reader now exposes a peek() function to get the first few bytes from the response body. This will be no less than 100 bytes (assuming the body is that big), but could be more. Streaming API, via res.next() continues to work as-is even if peek() is called. Introduce Mime.sniff() that detects a few common types - the ones that we care about right now - from the body content.
This commit is contained in:
@@ -24,6 +24,17 @@ pub const expectError = std.testing.expectError;
|
||||
pub const expectString = std.testing.expectEqualStrings;
|
||||
pub const expectEqualSlices = std.testing.expectEqualSlices;
|
||||
|
||||
// sometimes it's super useful to have an arena you don't really care about
|
||||
// in a test. Like, you need a mutable string, so you just want to dupe a
|
||||
// string literal. It has nothing to do with the code under test, it's just
|
||||
// infrastructure for the test itself.
|
||||
pub var arena_instance = std.heap.ArenaAllocator.init(std.heap.c_allocator);
|
||||
pub const arena_allocator = arena_instance.allocator();
|
||||
|
||||
pub fn reset() void {
|
||||
_ = arena_instance.reset(.{ .retain_capacity = {} });
|
||||
}
|
||||
|
||||
const App = @import("app.zig").App;
|
||||
const parser = @import("browser/netsurf.zig");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user