From c02151607bf770098918540613a2e8b0ab5d9ad7 Mon Sep 17 00:00:00 2001 From: demoManito <1430482733@qq.com> Date: Tue, 28 Mar 2023 11:21:36 +0800 Subject: [PATCH] fix --- contrib/registry/eureka/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)