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

Method TokenIsValid

api/client.go:78–91  ·  view source on GitHub ↗

TokenIsValid calls the API to determine whether the token is valid.

()

Source from the content-addressed store, hash-verified

76
77// TokenIsValid calls the API to determine whether the token is valid.
78func (c *Client) TokenIsValid() (bool, error) {
79 url := fmt.Sprintf("%s/validate_token", c.APIBaseURL)
80 req, err := c.NewRequest("GET", url, nil)
81 if err != nil {
82 return false, err
83 }
84 resp, err := c.Do(req)
85 if err != nil {
86 return false, err
87 }
88 defer resp.Body.Close()
89
90 return resp.StatusCode == http.StatusOK, nil
91}
92
93// IsPingable calls the API /ping to determine whether the API can be reached.
94func (c *Client) IsPingable() error {

Callers 1

runConfigureFunction · 0.95

Calls 2

NewRequestMethod · 0.95
DoMethod · 0.95

Tested by

no test coverage detected