Skip to content

Commit

Permalink
ensure content-length
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Feb 6, 2018
1 parent e487483 commit 44cd006
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions req.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ func (r *Req) Do(method, rawurl string, vs ...interface{}) (resp *Resp, err erro
}
}

if length := req.Header.Get("Content-Length"); length != "" {
if l, err := strconv.ParseInt(length, 10, 64); err == nil {
req.ContentLength = l
}
}

if len(uploads) > 0 && (req.Method == "POST" || req.Method == "PUT") { // multipart
var up UploadProgress
if uploadProgress != nil {
Expand Down

0 comments on commit 44cd006

Please sign in to comment.