change to c.Request.BodyStream()

This commit is contained in:
wjqserver 2025-04-21 13:47:45 +08:00
parent 2eb6a9810b
commit 809032a970
2 changed files with 11 additions and 13 deletions

View file

@ -1,7 +1,6 @@
package proxy
import (
"bytes"
"context"
"fmt"
"ghproxy/config"
@ -38,17 +37,17 @@ var (
func ChunkedProxyRequest(ctx context.Context, c *app.RequestContext, u string, cfg *config.Config, matcher string) {
var (
method []byte
bodyReader *bytes.Buffer
req *http.Request
resp *http.Response
err error
method []byte
//bodyReader *bytes.Buffer
req *http.Request
resp *http.Response
err error
)
method = c.Request.Method()
bodyReader = bytes.NewBuffer(c.Request.Body())
//bodyReader = bytes.NewBuffer(c.Request.Body())
req, err = client.NewRequest(string(method), u, bodyReader)
req, err = client.NewRequest(string(method), u, c.Request.BodyStream())
if err != nil {
HandleError(c, fmt.Sprintf("Failed to create request: %v", err))
return