Skip to content

Commit

Permalink
Clarify HTTP Host header changelog wording and make header check ca…
Browse files Browse the repository at this point in the history
…se-insensitive (#443)

* Clarify wording on changelog note.

* Make host header check case-insensitive.
  • Loading branch information
SBGoods authored Jul 24, 2024
1 parent fb5fd5a commit 270412b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .changes/unreleased/NOTES-20240723-162543.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: NOTES
body: |+
data-source/http: Previous versions of this provider ignored any `Host` headers specified in the `request_headers` attribute when setting the HTTP request. Any specified `Host` request headers will now override the `url` attribute host.
data-source/http: Previous versions of this provider ignored any `Host` headers specified in the `request_headers` attribute when setting the HTTP request. Any specified `Host` request header will now be set on the HTTP request.
For example, in the following configuration:
```hcl
Expand All @@ -11,7 +11,7 @@ body: |+
}
}
```
The HTTP request host will now be `www.differentexample.com` instead of `www.example.com`.
The HTTP request URL host is still `www.example.com` but the HTTP request `Host` header will now be `www.differentexample.com` instead of `www.example.com`.
time: 2024-07-23T16:25:43.160519-04:00
custom:
Issue: "440"
2 changes: 1 addition & 1 deletion internal/provider/data_source_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
}

request.Header.Set(name, header)
if name == "Host" {
if strings.ToLower(name) == "host" {
request.Host = header
}
}
Expand Down

0 comments on commit 270412b

Please sign in to comment.