Support lazy streaming multipart file binding
Summary
Following the discussion in go-swagger/go-swagger#3407, I would like to add opt-in lazy streaming support for multipart file parameters in go-openapi/runtime.
Today BindForm relies on http.Request.ParseMultipartForm, so the complete request body is consumed before the application handler receives the file.
The proposed server-side extension is parameter-level:
x-go-server-streaming: true
The runtime should expose the file payload lazily, while preserving the current buffered behavior by default.
Requirements
- Support form fields before and after streamed files.
- Support multiple file parts.
- Avoid hidden background goroutines.
- Define reader ownership, closing, draining, and error propagation.
- Keep parameters requiring
Seek, such as those with minLength or maxLength, on the buffered path.
- Preserve compatibility with the existing
BindForm behavior.
The reproducer, logs, prototype, and design discussion are available in:
go-swagger/go-swagger#3407
I have created a fork and would like to prepare the runtime design and implementation.
Support lazy streaming multipart file binding
Summary
Following the discussion in go-swagger/go-swagger#3407, I would like to add opt-in lazy streaming support for multipart file parameters in
go-openapi/runtime.Today
BindFormrelies onhttp.Request.ParseMultipartForm, so the complete request body is consumed before the application handler receives the file.The proposed server-side extension is parameter-level:
The runtime should expose the file payload lazily, while preserving the current buffered behavior by default.
Requirements
Seek, such as those withminLengthormaxLength, on the buffered path.BindFormbehavior.The reproducer, logs, prototype, and design discussion are available in:
go-swagger/go-swagger#3407
I have created a fork and would like to prepare the runtime design and implementation.