21 lines
335 B
Go
21 lines
335 B
Go
package eia
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
func (c *Client) Ping() error {
|
|
ctx, cncl := context.WithTimeout(c.ctx, c.healthCheckTimeout)
|
|
defer cncl()
|
|
|
|
resp, err := c.GetV2(ctx)
|
|
if err != nil {
|
|
return err
|
|
} else if resp.StatusCode != 200 {
|
|
return fmt.Errorf("non-200 response [%s] from eia api", resp.Status)
|
|
}
|
|
|
|
return nil
|
|
}
|