This commit is contained in:
Yun
2026-05-03 23:58:06 +08:00
commit ab454a6ec5
4 changed files with 110 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package netx
import (
"bytes"
"io"
"net/http"
)
// 读取POST请求的原始参数
func GetOriginParams(r *http.Request) ([]byte, error) {
buf := &bytes.Buffer{}
tea := io.TeeReader(r.Body, buf)
body, err := io.ReadAll(tea)
if err != nil && err != io.EOF {
return []byte{}, err
}
r.Body = io.NopCloser(buf)
return body, nil
}