diff --git a/contrib/registry/eureka/client.go b/contrib/registry/eureka/client.go index c0555b2b2..cd33af25e 100644 --- a/contrib/registry/eureka/client.go +++ b/contrib/registry/eureka/client.go @@ -324,7 +324,8 @@ func (e *Client) request(ctx context.Context, method string, params []string, in _ = resp.Body.Close() }() - if resp.StatusCode == http.StatusOK { + switch resp.StatusCode { + case http.StatusOK: data, err := io.ReadAll(resp.Body) if err != nil { return false, err @@ -334,8 +335,7 @@ func (e *Client) request(ctx context.Context, method string, params []string, in return false, err } return false, nil - } - if resp.StatusCode == http.StatusNoContent { + case http.StatusNoContent: return false, nil } return false, fmt.Errorf("response error %d", resp.StatusCode)