Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support releases-api returned content-type #57

Merged
merged 3 commits into from May 10, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/releasesjson/releases.go
Expand Up @@ -79,7 +79,7 @@ func (r *Releases) ListProductVersions(ctx context.Context, productName string)
}

contentType := resp.Header.Get("content-type")
if contentType != "application/json" {
if contentType != "application/json" && contentType != "application/vnd+hashicorp.releases-api.v0+json" {
return nil, fmt.Errorf("unexpected Content-Type: %q", contentType)
}

Expand Down Expand Up @@ -144,7 +144,7 @@ func (r *Releases) GetProductVersion(ctx context.Context, product string, versio
}

contentType := resp.Header.Get("content-type")
if contentType != "application/json" {
if contentType != "application/json" && contentType != "application/vnd+hashicorp.releases-api.v0+json" {
return nil, fmt.Errorf("unexpected Content-Type: %q", contentType)
}

Expand Down
6 changes: 2 additions & 4 deletions product/consul.go
Expand Up @@ -15,9 +15,7 @@ import (
var consulVersionOutputRe = regexp.MustCompile(`Consul ` + simpleVersionRe)

var (
v1_16 = version.Must(version.NewVersion("1.16"))
// TODO: version.MustConstraint() ?
v1_16c, _ = version.NewConstraint("1.16")
v1_18 = version.Must(version.NewVersion("1.18"))
)

var Consul = Product{
Expand Down Expand Up @@ -52,6 +50,6 @@ var Consul = Product{
BuildInstructions: &BuildInstructions{
GitRepoURL: "https://github.com/hashicorp/consul.git",
PreCloneCheck: &build.GoIsInstalled{},
Build: &build.GoBuild{Version: v1_16},
Build: &build.GoBuild{Version: v1_18},
},
}