mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
client: Client.addHeaders: remove special handling for api < 1.25
Commite98e4a7111introduced functionality to hide experimental commands, and hide commands based on API version negotiation. Before that commit, the user-agent header was used to detect version-mismatches between the daemon and client based on their binary version;3975d648b7/api/server/middleware/user_agent.go (L32-L44)Because of the above, a check was added to prevent custom headers from modifying the User-Agent, but given that the user-agent header changed formatting, and api < 1.25 is long deprecated, it's not very meaningful to add this check, so let's remove it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -277,9 +276,6 @@ func (cli *Client) addHeaders(req *http.Request, headers http.Header) *http.Requ
|
||||
// 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") && http.CanonicalHeaderKey(k) == "User-Agent" {
|
||||
continue
|
||||
}
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user