diff options
Diffstat (limited to 'src/go/plugin/go.d/pkg/web/client_test.go')
-rw-r--r-- | src/go/plugin/go.d/pkg/web/client_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/go/plugin/go.d/pkg/web/client_test.go b/src/go/plugin/go.d/pkg/web/client_test.go new file mode 100644 index 000000000..ead1486c3 --- /dev/null +++ b/src/go/plugin/go.d/pkg/web/client_test.go @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package web + +import ( + "net/http" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestNewHTTPClient(t *testing.T) { + client, _ := NewHTTPClient(Client{ + Timeout: Duration(time.Second * 5), + NotFollowRedirect: true, + ProxyURL: "http://127.0.0.1:3128", + }) + + assert.IsType(t, (*http.Client)(nil), client) + assert.Equal(t, time.Second*5, client.Timeout) + assert.NotNil(t, client.CheckRedirect) +} |