mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
4
tools.go
4
tools.go
@@ -198,8 +198,6 @@ func NewRequestWithContext(ctx context.Context, method string, u *url.URL, body
|
||||
if body != nil {
|
||||
if v, ok := body.(interface{ Len() int }); ok {
|
||||
req.ContentLength = int64(v.Len())
|
||||
} else {
|
||||
req.ContentLength = -1
|
||||
}
|
||||
if _, ok := body.(io.Seeker); ok {
|
||||
req.Body = &requestBody{body}
|
||||
@@ -208,8 +206,6 @@ func NewRequestWithContext(ctx context.Context, method string, u *url.URL, body
|
||||
} else {
|
||||
req.Body = io.NopCloser(body)
|
||||
}
|
||||
} else {
|
||||
req.ContentLength = -1
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user