mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
client: checkResponseErr: don't read body for HEAD requests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -236,7 +236,11 @@ func checkResponseErr(serverResp *http.Response) (retErr error) {
|
||||
if statusMsg == "" {
|
||||
statusMsg = http.StatusText(serverResp.StatusCode)
|
||||
}
|
||||
if serverResp.Body != nil {
|
||||
var reqMethod string
|
||||
if serverResp.Request != nil {
|
||||
reqMethod = serverResp.Request.Method
|
||||
}
|
||||
if serverResp.Body != nil && reqMethod != http.MethodHead {
|
||||
bodyMax := 1 * 1024 * 1024 // 1 MiB
|
||||
bodyR := &io.LimitedReader{
|
||||
R: serverResp.Body,
|
||||
|
||||
6
vendor/github.com/moby/moby/client/request.go
generated
vendored
6
vendor/github.com/moby/moby/client/request.go
generated
vendored
@@ -236,7 +236,11 @@ func checkResponseErr(serverResp *http.Response) (retErr error) {
|
||||
if statusMsg == "" {
|
||||
statusMsg = http.StatusText(serverResp.StatusCode)
|
||||
}
|
||||
if serverResp.Body != nil {
|
||||
var reqMethod string
|
||||
if serverResp.Request != nil {
|
||||
reqMethod = serverResp.Request.Method
|
||||
}
|
||||
if serverResp.Body != nil && reqMethod != http.MethodHead {
|
||||
bodyMax := 1 * 1024 * 1024 // 1 MiB
|
||||
bodyR := &io.LimitedReader{
|
||||
R: serverResp.Body,
|
||||
|
||||
Reference in New Issue
Block a user