From ee6568a52ad32dd2cacf6caf85b8761bb7f0d04a Mon Sep 17 00:00:00 2001 From: foxyriver Date: Wed, 23 Nov 2016 17:17:16 +0800 Subject: [PATCH] use status code const to express http status --- pkg/kubectl/resource/visitor.go | 2 +- pkg/kubelet/config/http.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/resource/visitor.go b/pkg/kubectl/resource/visitor.go index f8909bf15b..bbec413e9c 100644 --- a/pkg/kubectl/resource/visitor.go +++ b/pkg/kubectl/resource/visitor.go @@ -263,7 +263,7 @@ func readHttpWithRetries(get httpget, duration time.Duration, u string, attempts } // Error - Set the error condition from the StatusCode - if statusCode != 200 { + if statusCode != http.StatusOK { err = fmt.Errorf("unable to read URL %q, server reported %s, status code=%d", u, status, statusCode) } diff --git a/pkg/kubelet/config/http.go b/pkg/kubelet/config/http.go index 41ee92c6e3..58ec24f35a 100644 --- a/pkg/kubelet/config/http.go +++ b/pkg/kubelet/config/http.go @@ -96,7 +96,7 @@ func (s *sourceURL) extractFromURL() error { if err != nil { return err } - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { return fmt.Errorf("%v: %v", s.url, resp.Status) } if len(data) == 0 {