(client *http.Client, repo ghrepo.Interface)
| 10 | ) |
| 11 | |
| 12 | func deleteRepo(client *http.Client, repo ghrepo.Interface) error { |
| 13 | oldClient := *client |
| 14 | client = &oldClient |
| 15 | client.CheckRedirect = func(req *http.Request, via []*http.Request) error { |
| 16 | return http.ErrUseLastResponse |
| 17 | } |
| 18 | |
| 19 | url := fmt.Sprintf("%srepos/%s", |
| 20 | ghinstance.RESTPrefix(repo.RepoHost()), |
| 21 | ghrepo.FullName(repo)) |
| 22 | |
| 23 | request, err := http.NewRequest("DELETE", url, nil) |
| 24 | if err != nil { |
| 25 | return err |
| 26 | } |
| 27 | |
| 28 | resp, err := client.Do(request) |
| 29 | if err != nil { |
| 30 | return err |
| 31 | } |
| 32 | defer resp.Body.Close() |
| 33 | |
| 34 | if resp.StatusCode > 299 { |
| 35 | api.EndpointNeedsScopes(resp, "delete_repo") |
| 36 | return api.HandleHTTPError(resp) |
| 37 | } |
| 38 | |
| 39 | return nil |
| 40 | } |
no test coverage detected