Commit e0b83af9 authored by Eric Chiang's avatar Eric Chiang Committed by GitHub

Merge pull request #629 from ericchiang/dev-storage-kubernetes-dont-print-error

storage/kubernetes: don't automatically print errors on bad HTTP status codes
parents 6c4ad8c0 138ff96c
......@@ -10,7 +10,6 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"os"
......@@ -95,18 +94,17 @@ func checkHTTPErr(r *http.Response, validStatusCodes ...int) error {
return fmt.Errorf("read response body: %v", err)
}
// Check this case after we read the body so the connection can be reused.
if r.StatusCode == http.StatusNotFound {
return storage.ErrNotFound
}
var url, method string
if r.Request != nil {
method = r.Request.Method
url = r.Request.URL.String()
}
err = &httpErr{method, url, r.StatusCode, body}
log.Printf("%s", err)
if r.StatusCode == http.StatusNotFound {
return storage.ErrNotFound
}
return err
return &httpErr{method, url, r.StatusCode, body}
}
// Close the response body. The initial request is drained so the connection can
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment