Skip to content

Commit 00a6b15

Browse files
committed
fix: copy request header
Signed-off-by: arkbriar <[email protected]>
1 parent d70c23f commit 00a6b15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

proxy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ func newRequest(ctx context.Context, method string, url string, header http.Head
196196
if err != nil {
197197
return nil, err
198198
}
199-
r.Header["Accept-Encoding"] = header["Accept-Encoding"]
199+
r.Header = header.Clone()
200200
return r, nil
201201
case http.MethodPost:
202202
r, err := http.NewRequestWithContext(ctx, method, url, strings.NewReader(values.Encode()))
203203
if err != nil {
204204
return nil, err
205205
}
206-
r.Header["Accept-Encoding"] = header["Accept-Encoding"]
207-
r.Header.Set("Content-Type", "application/x-www-form-urlencoded")
206+
r.Header = header.Clone()
207+
r.Header["Content-Type"] = []string{"application/x-www-form-urlencoded"}
208208
return r, nil
209209
default:
210210
panic("unsupported method")

0 commit comments

Comments
 (0)