MCPcopy Index your code
hub / github.com/cli/cli / apiGet

Function apiGet

pkg/cmd/run/shared/artifacts.go:53–75  ·  view source on GitHub ↗
(httpClient *http.Client, url string, data interface{})

Source from the content-addressed store, hash-verified

51}
52
53func apiGet(httpClient *http.Client, url string, data interface{}) (string, error) {
54 req, err := http.NewRequest("GET", url, nil)
55 if err != nil {
56 return "", err
57 }
58
59 resp, err := httpClient.Do(req)
60 if err != nil {
61 return "", err
62 }
63 defer resp.Body.Close()
64
65 if resp.StatusCode > 299 {
66 return "", api.HandleHTTPError(resp)
67 }
68
69 dec := json.NewDecoder(resp.Body)
70 if err := dec.Decode(data); err != nil {
71 return "", err
72 }
73
74 return findNextPage(resp), nil
75}
76
77var linkRE = regexp.MustCompile(`<([^>]+)>;\s*rel="([^"]+)"`)
78

Callers 1

ListArtifactsFunction · 0.85

Calls 4

HandleHTTPErrorFunction · 0.92
findNextPageFunction · 0.70
DoMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected