From 3cbd70f73a6ad0f8406e256790132cf50c20a883 Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 7 Nov 2025 10:21:15 +0800 Subject: [PATCH] fix(health_check): correct agent routes health check logic --- agent/pkg/agent/http_requests.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/agent/pkg/agent/http_requests.go b/agent/pkg/agent/http_requests.go index 1f71dcba..aeae1221 100644 --- a/agent/pkg/agent/http_requests.go +++ b/agent/pkg/agent/http_requests.go @@ -60,11 +60,8 @@ func (cfg *AgentConfig) DoHealthCheck(timeout time.Duration, query string) (ret } if status := resp.StatusCode(); status != http.StatusOK { - // clone body since fasthttp response will be released - body := resp.Body() - cloneBody := make([]byte, len(body)) - copy(cloneBody, body) - return ret, fmt.Errorf("HTTP %d %s", status, cloneBody) + ret.Detail = fmt.Sprintf("HTTP %d %s", status, resp.Body()) + return ret, nil } else { err = sonic.Unmarshal(resp.Body(), &ret) if err != nil {