From ff3a8722f9abf58db1c52e53632932e13a7d42b1 Mon Sep 17 00:00:00 2001 From: XOF Date: Mon, 15 Dec 2025 19:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20proxy/handler.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/handler.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxy/handler.go b/proxy/handler.go index f7fe17f..21b33c3 100644 --- a/proxy/handler.go +++ b/proxy/handler.go @@ -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{