MCPcopy Create free account
hub / github.com/exercism/cli / IsPingable

Method IsPingable

api/client.go:94–110  ·  view source on GitHub ↗

IsPingable calls the API /ping to determine whether the API can be reached.

()

Source from the content-addressed store, hash-verified

92
93// IsPingable calls the API /ping to determine whether the API can be reached.
94func (c *Client) IsPingable() error {
95 url := fmt.Sprintf("%s/ping", c.APIBaseURL)
96 req, err := c.NewRequest("GET", url, nil)
97 if err != nil {
98 return err
99 }
100 resp, err := c.Do(req)
101 if err != nil {
102 return err
103 }
104 defer resp.Body.Close()
105
106 if resp.StatusCode != http.StatusOK {
107 return fmt.Errorf("API returned %s", resp.Status)
108 }
109 return nil
110}

Callers 1

runConfigureFunction · 0.95

Calls 2

NewRequestMethod · 0.95
DoMethod · 0.95

Tested by

no test coverage detected