-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Context.FormValue() and Context.FormFile() for form handling #55
Copy link
Copy link
Closed
Labels
area/apiPublic-facing API surfacePublic-facing API surfaceenhancementNew feature or requestNew feature or requestsize/M~2-3 days of work~2-3 days of work
Milestone
Description
Summary
Add form-data parsing methods to Context:
Context.FormValue(key string) string— returns a form field value fromapplication/x-www-form-urlencodedormultipart/form-databodies.Context.FormFile(key string) (*multipart.FileHeader, error)— returns an uploaded file from a multipart form.
Motivation
Form handling is a common web pattern for HTML forms, file uploads, and API endpoints. Currently users must parse the body manually. All major frameworks provide these helpers.
Scope
- Parse
Content-Typeheader to determine form type. - For
application/x-www-form-urlencoded: useurl.ParseQueryon body. - For
multipart/form-data: usemime/multipartpackage. - Cache parsed form data on the Context (similar to query caching).
- Consider memory limits for multipart uploads (configurable max body size).
Non-breaking
Additive methods on Context. No existing API changes required.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/apiPublic-facing API surfacePublic-facing API surfaceenhancementNew feature or requestNew feature or requestsize/M~2-3 days of work~2-3 days of work