From 168fd419b5ce55514778dc284e0d1fc92bbe3dcd Mon Sep 17 00:00:00 2001 From: Scott Macfarlane <36851+smacfarlane@users.noreply.github.com> Date: Mon, 9 May 2022 23:49:42 -0700 Subject: [PATCH] Support releases-api returned content-type (#57) * Support releases-api returned content-type Signed-off-by: Scott Macfarlane * Set Go to v1.18 when building consul from source Signed-off-by: Scott Macfarlane * remove unused variables Co-authored-by: Radek Simko --- internal/releasesjson/releases.go | 4 ++-- product/consul.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/releasesjson/releases.go b/internal/releasesjson/releases.go index 2b34201..66d3524 100644 --- a/internal/releasesjson/releases.go +++ b/internal/releasesjson/releases.go @@ -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) } @@ -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) } diff --git a/product/consul.go b/product/consul.go index d4600a2..78294d1 100644 --- a/product/consul.go +++ b/product/consul.go @@ -1,5 +1,6 @@ package product + const consulName = "consul" var Consul = Product{