Skip to content

Commit

Permalink
Fix posting payload
Browse files Browse the repository at this point in the history
Cherrypicking: rakyll#285
  • Loading branch information
rjshrjndrn committed Jul 25, 2024
1 parent ca8a616 commit 0e6980a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ import (
)

// Max size of the buffer of result channel.
const maxResult = 1000000
const maxIdleConn = 500
const (
maxResult = 1000000
maxIdleConn = 500
)

type result struct {
err error
Expand Down Expand Up @@ -183,11 +185,12 @@ func (b *Work) makeRequest(c *http.Client) {
}
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
resp, err := c.Do(req)
req.Close = true
if err == nil {
size = resp.ContentLength
code = resp.StatusCode
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
defer resp.Body.Close()
}
t := now()
resDuration = t - resStart
Expand Down

0 comments on commit 0e6980a

Please sign in to comment.