Merge pull request #3056 from arimu1/fix/3052-fetch-readablestream-body

fix(net): buffer closed ReadableStream bodies for fetch POST
This commit is contained in:
Karl Seguin authored and GitHub committed 2026-07-26 12:54:18 +08:00
commit f697c2087c
4 files changed
+152 -8

No files matched your search

+15
View File
@@ -988,6 +988,21 @@ fn testHTTPHandler(req: *std.http.Server.Request) !void {
});
}
if (std.mem.eql(u8, path, "/echo_body")) {
// Echo the request body back verbatim, so tests can assert on the bytes
// a request actually sent rather than just on its status.
var body_buf: [4096]u8 = undefined;
const body = if (req.head.method.requestHasBody())
try req.readerExpectNone(&body_buf).allocRemaining(arena_allocator, .limited(body_buf.len))
else
"";
return req.respond(body, .{
.extra_headers = &.{
.{ .name = "Content-Type", .value = "text/plain; charset=utf-8" },
},
});
}
if (std.mem.eql(u8, path, "/redirect_to_echo")) {
// 302 to /echo_method. Used by the Page.reload-after-redirect test to
// confirm a POST→302→GET chain doesn't replay POST on reload.