INNER CODE UNIT · Go
httpClient
m3db/m3 · scripts/development/m3_consumer_service/bootstrap/main.go:171
httpClient = &http.Client{Timeout: 15 * time.Second}
}
return &coordinatorClient{BaseURL: baseURL, Env: environment, HTTP: httpClient}
}
// HealthCheck checks the coordinator health endpoint and returns an error if not healthy.
func (c *coordinatorClient) HealthCheck(ctx context.Context) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.BaseURL+"/health", nil)
if err != nil {
return err
}
resp, err := c.HTTP.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
b, _ := io.ReadAll(resp.Body)