MCPcopy Create free account
hub / github.com/cli/cli / handleHTTPError

Function handleHTTPError

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

Source from the content-addressed store, hash-verified

319}
320
321func handleHTTPError(resp *http.Response) error {
322 httpError := httpError{
323 RequestURL: resp.Request.URL,
324 StatusCode: resp.StatusCode,
325 }
326 if !jsonTypeRE.MatchString(resp.Header.Get("Content-Type")) {
327 httpError.Message = resp.Status
328 return httpError
329 }
330 body, err := io.ReadAll(resp.Body)
331 if err != nil {
332 return err
333 }
334 if err := json.Unmarshal(body, &httpError); err != nil {
335 return err
336 }
337 return httpError
338}
339
340// nextPage extracts the next page number from an API response's link header. if
341// 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