mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Fallback to reading the x-terraform-get header if the module registry returns an empty json body (#2079)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
This commit is contained in:
parent
ce6f727755
commit
c9541d81b6
@ -22,6 +22,7 @@ import (
|
||||
"github.com/hashicorp/go-retryablehttp"
|
||||
svchost "github.com/hashicorp/terraform-svchost"
|
||||
"github.com/hashicorp/terraform-svchost/disco"
|
||||
|
||||
"github.com/opentofu/opentofu/internal/httpclient"
|
||||
"github.com/opentofu/opentofu/internal/logging"
|
||||
"github.com/opentofu/opentofu/internal/registry/regsrc"
|
||||
@ -246,6 +247,11 @@ func (c *Client) ModuleLocation(ctx context.Context, module *regsrc.Module, vers
|
||||
|
||||
location = v.Location
|
||||
|
||||
// if the location is empty, we will fallback to the header
|
||||
if location == "" {
|
||||
location = resp.Header.Get(xTerraformGet)
|
||||
}
|
||||
|
||||
case http.StatusNoContent:
|
||||
// FALLBACK: set the found location from the header
|
||||
location = resp.Header.Get(xTerraformGet)
|
||||
|
Loading…
Reference in New Issue
Block a user