MCPcopy Create free account
hub / github.com/brimdata/super / post

Method post

api/client/auth0/auth0.go:148–169  ·  view source on GitHub ↗
(ctx context.Context, path string, body, out any)

Source from the content-addressed store, hash-verified

146}
147
148func (c *Client) post(ctx context.Context, path string, body, out any) error {
149 b, err := json.Marshal(body)
150 if err != nil {
151 return err
152 }
153 u := c.url
154 u.Path = path
155 req, err := http.NewRequestWithContext(ctx, "POST", u.String(), bytes.NewReader(b))
156 if err != nil {
157 return err
158 }
159 req.Header.Set("Content-Type", "application/json")
160 res, err := http.DefaultClient.Do(req)
161 if err != nil {
162 return err
163 }
164 defer res.Body.Close()
165 if res.StatusCode < 200 || res.StatusCode > 299 {
166 return parseError(res.Body)
167 }
168 return json.NewDecoder(res.Body).Decode(out)
169}
170
171func parseError(body io.Reader) error {
172 var aerr APIError

Callers 6

GetDeviceCodeMethod · 0.95
getDeviceCodeTokensMethod · 0.95
RefreshTokenMethod · 0.95
create_poolMethod · 0.80
loadMethod · 0.80
query_rawMethod · 0.80

Calls 7

DoMethod · 0.80
parseErrorFunction · 0.70
StringMethod · 0.65
CloseMethod · 0.65
MarshalMethod · 0.45
NewReaderMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected