MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / authHeaders

Method authHeaders

internal/api/client.go:67–77  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

65}
66
67func (c *Client) authHeaders(req *http.Request) error {
68 if c.Config == nil {
69 return fmt.Errorf("not authenticated — run 'cloudcent init' first")
70 }
71 if c.Config.APIKey == nil {
72 return fmt.Errorf("API key not found in config")
73 }
74 req.Header.Set("X-Cli-Id", c.Config.CliID)
75 req.Header.Set("Authorization", "Bearer "+*c.Config.APIKey)
76 return nil
77}
78
79func (c *Client) doRequest(method, endpoint string, body io.Reader, contentType string, requireAuth bool) (int, []byte, error) {
80 req, err := http.NewRequest(method, endpoint, body)

Callers 1

doRequestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected