mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
fix(health_check): correct agent routes health check logic
This commit is contained in:
@@ -60,11 +60,8 @@ func (cfg *AgentConfig) DoHealthCheck(timeout time.Duration, query string) (ret
|
|||||||
}
|
}
|
||||||
|
|
||||||
if status := resp.StatusCode(); status != http.StatusOK {
|
if status := resp.StatusCode(); status != http.StatusOK {
|
||||||
// clone body since fasthttp response will be released
|
ret.Detail = fmt.Sprintf("HTTP %d %s", status, resp.Body())
|
||||||
body := resp.Body()
|
return ret, nil
|
||||||
cloneBody := make([]byte, len(body))
|
|
||||||
copy(cloneBody, body)
|
|
||||||
return ret, fmt.Errorf("HTTP %d %s", status, cloneBody)
|
|
||||||
} else {
|
} else {
|
||||||
err = sonic.Unmarshal(resp.Body(), &ret)
|
err = sonic.Unmarshal(resp.Body(), &ret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user