Add status code checks for 400 for repo API
@@ -155,7 +155,7 @@ func mkRepoRead(pack PackFunc, construct Constructor) schema.ReadContextFunc {
resp, err := m.(*resty.Client).R().SetResult(repo).Get(repositoriesEndpoint + d.Id())
if err != nil {
- if resp != nil && (resp.StatusCode() == http.StatusNotFound) {
+ if resp != nil && (resp.StatusCode() == http.StatusBadRequest || resp.StatusCode() == http.StatusNotFound) {
d.SetId("")
return nil
}
@@ -185,7 +185,7 @@ func mkRepoUpdate(unpack UnpackFunc, read schema.ReadContextFunc) schema.UpdateC
func deleteRepo(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
resp, err := m.(*resty.Client).R().Delete(repositoriesEndpoint + d.Id())
- if err != nil && (resp != nil && resp.StatusCode() == http.StatusNotFound) {
+ if err != nil && (resp != nil && (resp.StatusCode() == http.StatusBadRequest || resp.StatusCode() == http.StatusNotFound)) {
d.SetId("")
return nil
}
