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

Consider any HTTP response code > 399 as an error #3834

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/downloads/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *ArtifactURLResolver) Resolve() (string, string, error) {
return backoff.Permanent(err)
}

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

Expand Down Expand Up @@ -242,7 +242,7 @@ func (as *ArtifactsSnapshotVersion) GetSnapshotArtifactVersion(project string, v
return backoff.Permanent(err)
}

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

Expand Down Expand Up @@ -380,7 +380,7 @@ func (asur *ArtifactsSnapshotURLResolver) Resolve() (string, string, error) {
return backoff.Permanent(err)
}

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/downloads/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func GetElasticArtifactVersion(version string) (string, error) {
return fmt.Errorf("error getting %s: %w", url, err)
}

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

Expand Down
Loading