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

Function GetRawGistFile

pkg/cmd/gist/shared/shared.go:251–275  ·  view source on GitHub ↗
(httpClient *http.Client, rawURL string)

Source from the content-addressed store, hash-verified

249}
250
251func GetRawGistFile(httpClient *http.Client, rawURL string) (string, error) {
252 req, err := http.NewRequest("GET", rawURL, nil)
253 if err != nil {
254 return "", err
255 }
256
257 resp, err := httpClient.Do(req)
258 if err != nil {
259 return "", err
260 }
261
262 defer resp.Body.Close()
263
264 if resp.StatusCode != http.StatusOK {
265 return "", api.HandleHTTPError(resp)
266 }
267
268 body, err := io.ReadAll(resp.Body)
269
270 if err != nil {
271 return "", err
272 }
273
274 return string(body), nil
275}

Callers 3

viewRunFunction · 0.92
editRunFunction · 0.92
TestGetRawGistFileFunction · 0.85

Calls 3

HandleHTTPErrorFunction · 0.92
DoMethod · 0.65
CloseMethod · 0.65

Tested by 1

TestGetRawGistFileFunction · 0.68