Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(handler): tee body for decode post action #1298

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/waku/src/lib/renderers/rsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,17 @@ export async function decodePostAction(
typeof contentType === 'string' &&
contentType.startsWith('multipart/form-data')
) {
const bodyBuf = await streamToArrayBuffer(ctx.req.body);
const [stream1, stream2] = ctx.req.body.tee();
ctx.req.body = stream1;
const bodyBuf = await streamToArrayBuffer(stream2);
// XXX This doesn't support streaming unlike busboy
const formData = await parseFormData(bodyBuf, contentType);
if (
Array.from(formData.keys()).every((key) => !key.startsWith('$ACTION_'))
) {
// Assuming this is probably for api
return null;
}
const serverBundlerConfig = new Proxy(
{},
{
Expand Down
Loading