更新 proxy/handler.go

This commit is contained in:
XOF
2025-12-15 19:33:10 +08:00
parent 3adf804ce5
commit ff3a8722f9

View File

@@ -3,6 +3,7 @@ package proxy
import (
"compress/gzip"
"bytes"
"io"
"log"
"net/http"
@@ -123,6 +124,13 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if r.Method == "POST" || r.Method == "PUT" || r.Method == "PATCH" {
if r.Body != nil {
body, _ := io.ReadAll(r.Body)
proxyReq.Body = io.NopCloser(bytes.NewReader(body))
proxyReq.ContentLength = int64(len(body))
}
}
h.setProxyHeaders(proxyReq, r)
client := &http.Client{