MCPcopy Index your code
hub / github.com/google/go-github / getArchiveLinkWithRateLimit

Method getArchiveLinkWithRateLimit

github/repos_contents.go:369–387  ·  view source on GitHub ↗
(ctx context.Context, u string, maxRedirects int)

Source from the content-addressed store, hash-verified

367}
368
369func (s *RepositoriesService) getArchiveLinkWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) {
370 req, err := s.client.NewRequest(ctx, "GET", u, nil)
371 if err != nil {
372 return nil, nil, err
373 }
374
375 url, resp, err := s.client.bareDoUntilFound(req, maxRedirects)
376 if err != nil {
377 return nil, resp, err
378 }
379 defer resp.Body.Close()
380
381 // If we didn't receive a valid Location in a 302 response
382 if url == nil {
383 return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status)
384 }
385
386 return url, resp, nil
387}

Callers 1

GetArchiveLinkMethod · 0.95

Calls 3

NewRequestMethod · 0.80
bareDoUntilFoundMethod · 0.80
CloseMethod · 0.80

Tested by

no test coverage detected