Added two methods:
- *Client.CustomHTTPHeaders() map[string]string
- *Client.SetCustomHTTPHeaders(headers map[string]string)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
| ... | ... |
@@ -212,12 +212,13 @@ func (cli *Client) getAPIPath(p string, query url.Values) string {
|
| 212 | 212 |
// ClientVersion returns the version string associated with this |
| 213 | 213 |
// instance of the Client. Note that this value can be changed |
| 214 | 214 |
// via the DOCKER_API_VERSION env var. |
| 215 |
+// This operation doesn't acquire a mutex. |
|
| 215 | 216 |
func (cli *Client) ClientVersion() string {
|
| 216 | 217 |
return cli.version |
| 217 | 218 |
} |
| 218 | 219 |
|
| 219 | 220 |
// UpdateClientVersion updates the version string associated with this |
| 220 |
-// instance of the Client. |
|
| 221 |
+// instance of the Client. This operation doesn't acquire a mutex. |
|
| 221 | 222 |
func (cli *Client) UpdateClientVersion(v string) {
|
| 222 | 223 |
if !cli.manualOverride {
|
| 223 | 224 |
cli.version = v |
| ... | ... |
@@ -244,3 +245,19 @@ func ParseHost(host string) (string, string, string, error) {
|
| 244 | 244 |
} |
| 245 | 245 |
return proto, addr, basePath, nil |
| 246 | 246 |
} |
| 247 |
+ |
|
| 248 |
+// CustomHTTPHeaders returns the custom http headers associated with this |
|
| 249 |
+// instance of the Client. This operation doesn't acquire a mutex. |
|
| 250 |
+func (cli *Client) CustomHTTPHeaders() map[string]string {
|
|
| 251 |
+ m := make(map[string]string) |
|
| 252 |
+ for k, v := range cli.customHTTPHeaders {
|
|
| 253 |
+ m[k] = v |
|
| 254 |
+ } |
|
| 255 |
+ return m |
|
| 256 |
+} |
|
| 257 |
+ |
|
| 258 |
+// SetCustomHTTPHeaders updates the custom http headers associated with this |
|
| 259 |
+// instance of the Client. This operation doesn't acquire a mutex. |
|
| 260 |
+func (cli *Client) SetCustomHTTPHeaders(headers map[string]string) {
|
|
| 261 |
+ cli.customHTTPHeaders = headers |
|
| 262 |
+} |