(httpClient *http.Client, release *shared.Release)
| 262 | } |
| 263 | |
| 264 | func deleteRelease(httpClient *http.Client, release *shared.Release) error { |
| 265 | req, err := http.NewRequest("DELETE", release.APIURL, nil) |
| 266 | if err != nil { |
| 267 | return err |
| 268 | } |
| 269 | |
| 270 | resp, err := httpClient.Do(req) |
| 271 | if err != nil { |
| 272 | return err |
| 273 | } |
| 274 | if resp.Body != nil { |
| 275 | defer resp.Body.Close() |
| 276 | } |
| 277 | |
| 278 | success := resp.StatusCode >= 200 && resp.StatusCode < 300 |
| 279 | if !success { |
| 280 | return api.HandleHTTPError(resp) |
| 281 | } |
| 282 | |
| 283 | if resp.StatusCode != 204 { |
| 284 | _, _ = io.Copy(io.Discard, resp.Body) |
| 285 | } |
| 286 | return nil |
| 287 | } |
| 288 | |
| 289 | // tokenHasWorkflowScope checks if the given http.Response's token has the workflow scope. |
| 290 | // Tokens that do not have OAuth scopes are assumed to have the workflow scope. |
no test coverage detected