Files
netx/param.go
T

20 lines
340 B
Go
Raw Normal View History

2026-05-03 23:58:06 +08:00
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
}