MCPcopy
hub / github.com/cli/cli / handleHTTPError

Function handleHTTPError

pkg/search/searcher.go:298–315  ·  view source on GitHub ↗
(resp *http.Response)

Source from the content-addressed store, hash-verified

296}
297
298func handleHTTPError(resp *http.Response) error {
299 httpError := httpError{
300 RequestURL: resp.Request.URL,
301 StatusCode: resp.StatusCode,
302 }
303 if !jsonTypeRE.MatchString(resp.Header.Get("Content-Type")) {
304 httpError.Message = resp.Status
305 return httpError
306 }
307 body, err := io.ReadAll(resp.Body)
308 if err != nil {
309 return err
310 }
311 if err := json.Unmarshal(body, &httpError); err != nil {
312 return err
313 }
314 return httpError
315}
316
317// nextPage extracts the next page number from an API response's link header. if
318// the provided link header is empty or there is no next page, zero is returned.

Callers 1

searchMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected