-
Notifications
You must be signed in to change notification settings - Fork 295
feat(readBody): support formdata type #1164
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
base: main
Are you sure you want to change the base?
Conversation
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")) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: #875
No description provided.