getJSON performs a GET request and decodes the JSON response into target.
(ctx context.Context, url string, target any)
| 370 | |
| 371 | // getJSON performs a GET request and decodes the JSON response into target. |
| 372 | func (r *Registry) getJSON(ctx context.Context, url string, target any) error { |
| 373 | resp, err := r.doGet(ctx, url, map[string]string{"Accept": "application/vnd.github+json"}) |
| 374 | if err != nil { |
| 375 | return err |
| 376 | } |
| 377 | defer resp.Body.Close() |
| 378 | |
| 379 | return json.NewDecoder(resp.Body).Decode(target) |
| 380 | } |
| 381 | |
| 382 | // download opens an HTTP connection to the given URL and returns the |
| 383 | // response body as an io.ReadCloser. The caller is responsible for closing it. |
no test coverage detected