mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-09-17 00:17:07 -04:00
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:
4 files changed
+152
-8
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user