更新 proxy/handler.go
This commit is contained in:
@@ -3,6 +3,7 @@ package proxy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -123,6 +124,13 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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)
|
h.setProxyHeaders(proxyReq, r)
|
||||||
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
|
|||||||
Reference in New Issue
Block a user