You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MaxBytes Setting Issue in go-zero Framework's httpx Package
Is your feature request related to a problem? Please describe.
When using the go-zero framework to handle large file uploads, I encountered request body size limitations. Currently, the Parse function in the httpx package returns an "unexpected EOF" error when processing large request bodies (such as base64-encoded PDF files) because the request body exceeds the default size limit.
Describe the solution you'd like
I would like the httpx package to provide a public API for setting the maximum request body size (MaxBytes). While it's possible to manually set this using http.MaxBytesReader, having a unified configuration method at the framework level would be more convenient.
I suggest adding a function to the httpx package, such as SetMaxBytes or ParseWithMaxBytes, allowing developers to specify the maximum request body size when calling the Parse function.
Then use json.Unmarshal instead of httpx.Parse to parse the request body, which breaks the framework's consistency.
If the httpx package could provide this functionality, it would greatly simplify the code for handling large requests while maintaining framework consistency.
The text was updated successfully, but these errors were encountered:
MaxBytes Setting Issue in go-zero Framework's httpx Package
Is your feature request related to a problem? Please describe.
When using the go-zero framework to handle large file uploads, I encountered request body size limitations. Currently, the Parse function in the httpx package returns an "unexpected EOF" error when processing large request bodies (such as base64-encoded PDF files) because the request body exceeds the default size limit.
Describe the solution you'd like
I would like the httpx package to provide a public API for setting the maximum request body size (MaxBytes). While it's possible to manually set this using http.MaxBytesReader, having a unified configuration method at the framework level would be more convenient.
I suggest adding a function to the httpx package, such as SetMaxBytes or ParseWithMaxBytes, allowing developers to specify the maximum request body size when calling the Parse function.
Describe alternatives you've considered
While these methods can solve the problem, providing a unified API at the framework level would be more elegant and consistent.
Additional context
Currently, we must manually add the following code in each handler that processes large requests:
Then use json.Unmarshal instead of httpx.Parse to parse the request body, which breaks the framework's consistency.
If the httpx package could provide this functionality, it would greatly simplify the code for handling large requests while maintaining framework consistency.
The text was updated successfully, but these errors were encountered: