Skip to content

Commit

Permalink
Use constructor for LimitedReader
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpt-alexanderneumann committed Sep 16, 2020
1 parent 7f26312 commit cb5298b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (r *Response) ReadBody(body io.Reader, maxBodySize int) (err error) {
// closed preemptively, closing the TCP connection. The reason is that opening a
// new connection likely has a much lower performance impact than tranferring large
// amounts of unwanted data over the network.
r.RawBody, err = ioutil.ReadAll(&io.LimitedReader{R: body, N: int64(maxBodySize)})
r.RawBody, err = ioutil.ReadAll(io.LimitReader(body, int64(maxBodySize)))
if err != nil {
return err
}
Expand Down

0 comments on commit cb5298b

Please sign in to comment.