Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 88ec185

Browse files
authored
Consider any HTTP response code > 399 as an error (#3834)
1 parent 19b3c81 commit 88ec185

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pkg/downloads/releases.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (r *ArtifactURLResolver) Resolve() (string, string, error) {
103103
return backoff.Permanent(err)
104104
}
105105

106-
if resp.StatusCode == http.StatusNotFound {
106+
if resp.StatusCode > 399 {
107107
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
108108
}
109109

@@ -242,7 +242,7 @@ func (as *ArtifactsSnapshotVersion) GetSnapshotArtifactVersion(project string, v
242242
return backoff.Permanent(err)
243243
}
244244

245-
if resp.StatusCode == http.StatusNotFound {
245+
if resp.StatusCode > 399 {
246246
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
247247
}
248248

@@ -380,7 +380,7 @@ func (asur *ArtifactsSnapshotURLResolver) Resolve() (string, string, error) {
380380
return backoff.Permanent(err)
381381
}
382382

383-
if resp.StatusCode == http.StatusNotFound {
383+
if resp.StatusCode > 399 {
384384
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
385385
}
386386

@@ -497,7 +497,7 @@ func (r *ReleaseURLResolver) Resolve() (string, string, error) {
497497
defer resp.Body.Close()
498498
_, _ = io.Copy(io.Discard, resp.Body)
499499

500-
if resp.StatusCode == http.StatusNotFound {
500+
if resp.StatusCode > 399 {
501501
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
502502
}
503503

pkg/downloads/versions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func GetElasticArtifactVersion(version string) (string, error) {
193193
return fmt.Errorf("error getting %s: %w", url, err)
194194
}
195195

196-
if resp.StatusCode == http.StatusNotFound {
196+
if resp.StatusCode > 399 {
197197
return backoff.Permanent(fmt.Errorf("version %s not found at %s", version, url))
198198
}
199199

0 commit comments

Comments
 (0)