fix: pre-read bodies with unknown length
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
// readRequestBody 在转发前完整读取请求体,确保读取失败时不会向上游发送损坏请求。
|
||||
func readRequestBody(r *http.Request, max int64) (captured []byte, truncated bool, err error) {
|
||||
if r.Body == nil || r.ContentLength == 0 {
|
||||
if r.Body == nil || r.Body == http.NoBody {
|
||||
return nil, false, nil
|
||||
}
|
||||
body, err := io.ReadAll(r.Body)
|
||||
|
||||
Reference in New Issue
Block a user