(ctx context.Context, u string, maxRedirects int)
| 367 | } |
| 368 | |
| 369 | func (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 | } |
no test coverage detected