diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2019-04-08 14:14:07 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2019-04-10 19:23:47 +0200 |
commit | b26aa97914dab997d6f8ebf1cb9c019f97e3c254 (patch) | |
tree | 7fd9f109dd4638af07c8c49fef82865be49a2f11 /client/options.go | |
parent | 8aa3262f291d245e801027a05bf049ecde734bd1 (diff) | |
download | docker-b26aa97914dab997d6f8ebf1cb9c019f97e3c254.tar.gz |
Add client.WithAPIVersionNegotiation() option
WithAPIVersionNegotiation enables automatic API version negotiation for the client.
With this option enabled, the client automatically negotiates the API version
to use when making requests. API version negotiation is performed on the first
request; subsequent requests will not re-negotiate.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'client/options.go')
-rw-r--r-- | client/options.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/options.go b/client/options.go index 33921867bf..f7588e4682 100644 --- a/client/options.go +++ b/client/options.go @@ -150,3 +150,14 @@ func WithVersion(version string) Opt { return nil } } + +// WithAPIVersionNegotiation enables automatic API version negotiation for the client. +// With this option enabled, the client automatically negotiates the API version +// to use when making requests. API version negotiation is performed on the first +// request; subsequent requests will not re-negotiate. +func WithAPIVersionNegotiation() Opt { + return func(c *Client) error { + c.negotiateVersion = true + return nil + } +} |