-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathhttp_client_test.go
51 lines (38 loc) · 1.1 KB
/
http_client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package awsbase
import (
"net/http"
"testing"
"github.com/hashicorp/aws-sdk-go-base/v2/internal/config"
"github.com/hashicorp/aws-sdk-go-base/v2/internal/test"
)
func TestHTTPClientConfiguration_basic(t *testing.T) {
client, err := defaultHttpClient(&config.Config{})
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
transport := client.GetTransport()
test.HTTPClientConfigurationTest_basic(t, transport)
}
func TestHTTPClientConfiguration_insecureHTTPS(t *testing.T) {
client, err := defaultHttpClient(&config.Config{
Insecure: true,
})
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
transport := client.GetTransport()
test.HTTPClientConfigurationTest_insecureHTTPS(t, transport)
}
func TestHTTPClientConfiguration_proxy(t *testing.T) {
test.HTTPClientConfigurationTest_proxy(t, transport)
}
func transport(t *testing.T, config *config.Config) *http.Transport {
t.Helper()
client, err := defaultHttpClient(config)
if err != nil {
t.Fatalf("creating client: %s", err)
}
return client.GetTransport()
}