Skip to content

Commit b42aed0

Browse files
committed
use content length to reserve body size
1 parent 2319485 commit b42aed0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/browser/fetch/fetch.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ pub fn fetch(input: RequestInput, options: ?RequestInit, page: *Page) !Env.Promi
172172
};
173173
}
174174

175+
if (transfer.getContentLength()) |cl| {
176+
try self.body.ensureTotalCapacity(self.arena, cl);
177+
}
178+
175179
var it = transfer.responseHeaderIterator();
176180
while (it.next()) |hdr| {
177181
const joined = try std.fmt.allocPrint(self.arena, "{s}: {s}", .{ hdr.name, hdr.value });

0 commit comments

Comments
 (0)