use status code const to express http status

This commit is contained in:
foxyriver 2016-11-23 17:17:16 +08:00
parent 48536eaef9
commit ee6568a52a
2 changed files with 2 additions and 2 deletions

View File

@ -263,7 +263,7 @@ func readHttpWithRetries(get httpget, duration time.Duration, u string, attempts
} }
// Error - Set the error condition from the StatusCode // 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) err = fmt.Errorf("unable to read URL %q, server reported %s, status code=%d", u, status, statusCode)
} }

View File

@ -96,7 +96,7 @@ func (s *sourceURL) extractFromURL() error {
if err != nil { if err != nil {
return err return err
} }
if resp.StatusCode != 200 { if resp.StatusCode != http.StatusOK {
return fmt.Errorf("%v: %v", s.url, resp.Status) return fmt.Errorf("%v: %v", s.url, resp.Status)
} }
if len(data) == 0 { if len(data) == 0 {