-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
httprequest.Read currently supports only a single gomultipart.File field per struct field name in multipart/form-data requests. It would be useful to support []gomultipart.File to allow multiple file uploads for the same field.
Current Behaviour
In pkg/httprequest/read.go, readFormData only handles typeFile (gomultipart.File) in the type switch and only accesses values[0] from the multipart file headers. A []gomultipart.File field falls through to the default case and returns a bad-request error.
Proposed Change
Decoding (pkg/httprequest/read.go):
- Add
typeFileSlice = reflect.TypeOf([]gomultipart.File{}) - Add a
case typeFileSlice:branch that iterates all file headers and builds a[]gomultipart.Fileslice
Encoding (go-client pkg/multipart):
- Add slice handling in
Encodeto iterate[]gomultipart.Fileelements and write each with the same field name
Use Case
HTTP handlers that accept requests with multiple file attachments (e.g. an LLM ask endpoint that can receive multiple images/documents alongside a text prompt).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels