Fix content length being incorrect when useModelName is used (#131)

* Fix content length being incorrect when useModelName is used
* Update c.Request.ContentLength as well
This commit is contained in:
Fadenfire
2025-05-14 21:37:54 -05:00
committed by GitHub
parent 8ada72eb57
commit f5763a94a0

View File

@@ -374,7 +374,8 @@ func (pm *ProxyManager) proxyOAIHandler(c *gin.Context) {
// dechunk it as we already have all the body bytes see issue #11
c.Request.Header.Del("transfer-encoding")
c.Request.Header.Add("content-length", strconv.Itoa(len(bodyBytes)))
c.Request.Header.Set("content-length", strconv.Itoa(len(bodyBytes)))
c.Request.ContentLength = int64(len(bodyBytes))
if err := processGroup.ProxyRequest(realModelName, c.Writer, c.Request); err != nil {
pm.sendErrorResponse(c, http.StatusInternalServerError, fmt.Sprintf("error proxying request: %s", err.Error()))