MCPcopy Create free account
hub / github.com/docker/docker-agent / getJSON

Method getJSON

pkg/toolinstall/registry.go:372–380  ·  view source on GitHub ↗

getJSON performs a GET request and decodes the JSON response into target.

(ctx context.Context, url string, target any)

Source from the content-addressed store, hash-verified

370
371// getJSON performs a GET request and decodes the JSON response into target.
372func (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.

Callers 2

latestVersionMethod · 0.95
latestVersionFilteredMethod · 0.95

Calls 2

doGetMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected