summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/http/http.go7
-rw-r--r--internal/test/server.go14
2 files changed, 13 insertions, 8 deletions
diff --git a/internal/http/http.go b/internal/http/http.go
index 4d8f3bc..ba081fd 100644
--- a/internal/http/http.go
+++ b/internal/http/http.go
@@ -147,8 +147,11 @@ type Client struct {
}
// Returns a HTTP client with some default settings
-func NewClient() *Client {
- c := &http.Client{}
+func NewClient(client *http.Client) *Client {
+ c := client
+ if c == nil {
+ c = &http.Client{}
+ }
// ReadLimit denotes the maximum amount of bytes that are read in HTTP responses
// This is used to prevent servers from sending huge amounts of data
// A limit of 16MB, although maybe much larger than needed, ensures that we do not run into problems
diff --git a/internal/test/server.go b/internal/test/server.go
index 71f1d00..6d6a0c2 100644
--- a/internal/test/server.go
+++ b/internal/test/server.go
@@ -33,12 +33,14 @@ func (srv *Server) Client() (*httpw.Client, error) {
certs.AddCert(root)
}
}
- // Override the client such that it only trusts the test server cert
- client := httpw.NewClient()
- client.Client.Transport = &http.Transport{
- TLSClientConfig: &tls.Config{
- RootCAs: certs,
+ client := &http.Client{
+ Transport: &http.Transport{
+ TLSClientConfig: &tls.Config{
+ RootCAs: certs,
+ },
},
}
- return client, nil
+ // Override the client such that it only trusts the test server cert
+ httpC := httpw.NewClient(client)
+ return httpC, nil
}