Skip to content

Conversation

huseeiin
Copy link
Contributor

No description provided.

@huseeiin huseeiin requested a review from pi0 as a code owner July 18, 2025 09:38
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

const text = await event.req.text();
const contentType = event.req.headers.get("content-type") || "";

if (contentType.startsWith("multipart/form-data"))
Copy link
Member

@pi0 pi0 Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make it opt-in by supporting event, opts?: { type: "json" | formData" } and throw an HTTPError if it is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make it opt-in by supporting event, opts?: { type: "json" | formData" } and throw an HTTPError if it is not.

i support this. but my changes remain valid, right? since opts is optional. when you specify type in opts, you're specifying a certain body type, when you're not, you're parsing any body as an object or string!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As security measure we should make types opt-in other than JSON (so if no options only json)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context: #875

@pi0 pi0 changed the title check for multipart/form-data feat(readBody): support formdata type Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants