feat(api): add request body decoding with Content-Encoding support
- Introduced `ReadRequestBody` helper function to support decoding request bodies based on "Content-Encoding" (e.g., `zstd`). - Replaced `c.GetRawData()` with `ReadRequestBody` across handlers to enable decoding. - Added test case to validate `zstd` decoding for compact responses.
This commit is contained in:
@@ -204,7 +204,7 @@ func (h *OpenAIAPIHandler) ImagesGenerations(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
rawJSON, err := c.GetRawData()
|
||||
rawJSON, err := handlers.ReadRequestBody(c)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, handlers.ErrorResponse{
|
||||
Error: handlers.ErrorDetail{
|
||||
@@ -435,7 +435,7 @@ func (h *OpenAIAPIHandler) imagesEditsFromMultipart(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *OpenAIAPIHandler) imagesEditsFromJSON(c *gin.Context) {
|
||||
rawJSON, err := c.GetRawData()
|
||||
rawJSON, err := handlers.ReadRequestBody(c)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, handlers.ErrorResponse{
|
||||
Error: handlers.ErrorDetail{
|
||||
|
||||
Reference in New Issue
Block a user