Skip to content

Commit

Permalink
client: use canonical names for HTTP Headers
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Mar 6, 2022
1 parent 85f1bfc commit 948c2c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ func (cli *Client) addHeaders(req *http.Request, headers headers) *http.Request
// Add CLI Config's HTTP Headers BEFORE we set the Docker headers
// then the user can't change OUR headers
for k, v := range cli.customHTTPHeaders {
if versions.LessThan(cli.version, "1.25") && k == "User-Agent" {
if versions.LessThan(cli.version, "1.25") && http.CanonicalHeaderKey(k) == "User-Agent" {
continue
}
req.Header.Set(k, v)
}

for k, v := range headers {
req.Header[k] = v
req.Header[http.CanonicalHeaderKey(k)] = v
}
return req
}
Expand Down

0 comments on commit 948c2c4

Please sign in to comment.