(httpClient *http.Client, repo ghrepo.Interface, id string)
| 11 | ) |
| 12 | |
| 13 | func deleteDeployKey(httpClient *http.Client, repo ghrepo.Interface, id string) error { |
| 14 | path := fmt.Sprintf("repos/%s/%s/keys/%s", repo.RepoOwner(), repo.RepoName(), id) |
| 15 | url := ghinstance.RESTPrefix(repo.RepoHost()) + path |
| 16 | |
| 17 | req, err := http.NewRequest("DELETE", url, nil) |
| 18 | if err != nil { |
| 19 | return err |
| 20 | } |
| 21 | |
| 22 | resp, err := httpClient.Do(req) |
| 23 | if err != nil { |
| 24 | return err |
| 25 | } |
| 26 | defer resp.Body.Close() |
| 27 | |
| 28 | if resp.StatusCode > 299 { |
| 29 | return api.HandleHTTPError(resp) |
| 30 | } |
| 31 | |
| 32 | _, err = io.Copy(io.Discard, resp.Body) |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } |
| 36 | |
| 37 | return nil |
| 38 | } |
no test coverage detected