use content length to reserve body size

This commit is contained in:
Muki Kiboigo
2025-09-11 21:19:19 -07:00
parent a875ce4d68
commit ed11eab0a7

View File

@@ -172,6 +172,10 @@ pub fn fetch(input: RequestInput, options: ?RequestInit, page: *Page) !Env.Promi
};
}
if (transfer.getContentLength()) |cl| {
try self.body.ensureTotalCapacity(self.arena, cl);
}
var it = transfer.responseHeaderIterator();
while (it.next()) |hdr| {
const joined = try std.fmt.allocPrint(self.arena, "{s}: {s}", .{ hdr.name, hdr.value });