Commit graph

6 commits

Author SHA1 Message Date
Sebastiaan van Stijn
a6048fc792
client: add WithUserAgent() option
When constructing the client, and setting the User-Agent, care must be
taken to apply the header in the right location, as custom headers can
be set in the CLI configuration, and merging these custom headers should
not override the User-Agent header.

This patch adds a dedicated `WithUserAgent()` option, which stores the
user-agent separate from other headers, centralizing the merging of
other headers, so that other parts of the (CLI) code don't have to be
concerned with merging them in the right order.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-09 09:59:29 +02:00
Sebastiaan van Stijn
31ee158394
client: defaultHTTPClient() accept URL
We're parsing the URL either way, so may just as well use the result.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-01 13:35:16 +01:00
Sebastiaan van Stijn
a5f6500958
replace deprecated gotest.tools' env.Patch() with t.SetEnv()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-28 12:12:39 +02:00
Sebastiaan van Stijn
eae20b1a1b
client: extract FromEnv parts to separate WithXX options
Implements three options;

- WithTLSClientConfigFromEnv()
- WithHostFromEnv()
- WithVersionFromEnv()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-10 17:15:40 +01:00
Sebastiaan van Stijn
9f0b3f5609
bump gotest.tools v3.0.1 for compatibility with Go 1.14
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-11 00:06:42 +01:00
Sebastiaan van Stijn
44982c775e
Add client.WithTimeout() option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-11 13:35:48 +02:00