mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #27622 from AkihiroSuda/client-set-http-header
client: add accessor methods for client.customHTTPHeaders
This commit is contained in:
commit
f244174664
1 changed files with 18 additions and 1 deletions
|
@ -212,12 +212,13 @@ func (cli *Client) getAPIPath(p string, query url.Values) string {
|
||||||
// ClientVersion returns the version string associated with this
|
// ClientVersion returns the version string associated with this
|
||||||
// instance of the Client. Note that this value can be changed
|
// instance of the Client. Note that this value can be changed
|
||||||
// via the DOCKER_API_VERSION env var.
|
// via the DOCKER_API_VERSION env var.
|
||||||
|
// This operation doesn't acquire a mutex.
|
||||||
func (cli *Client) ClientVersion() string {
|
func (cli *Client) ClientVersion() string {
|
||||||
return cli.version
|
return cli.version
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientVersion updates the version string associated with this
|
// UpdateClientVersion updates the version string associated with this
|
||||||
// instance of the Client.
|
// instance of the Client. This operation doesn't acquire a mutex.
|
||||||
func (cli *Client) UpdateClientVersion(v string) {
|
func (cli *Client) UpdateClientVersion(v string) {
|
||||||
if !cli.manualOverride {
|
if !cli.manualOverride {
|
||||||
cli.version = v
|
cli.version = v
|
||||||
|
@ -244,3 +245,19 @@ func ParseHost(host string) (string, string, string, error) {
|
||||||
}
|
}
|
||||||
return proto, addr, basePath, nil
|
return proto, addr, basePath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CustomHTTPHeaders returns the custom http headers associated with this
|
||||||
|
// instance of the Client. This operation doesn't acquire a mutex.
|
||||||
|
func (cli *Client) CustomHTTPHeaders() map[string]string {
|
||||||
|
m := make(map[string]string)
|
||||||
|
for k, v := range cli.customHTTPHeaders {
|
||||||
|
m[k] = v
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCustomHTTPHeaders updates the custom http headers associated with this
|
||||||
|
// instance of the Client. This operation doesn't acquire a mutex.
|
||||||
|
func (cli *Client) SetCustomHTTPHeaders(headers map[string]string) {
|
||||||
|
cli.customHTTPHeaders = headers
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue