github.com/netdata/go.d.plugin@v0.58.1/pkg/web/client_test.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package web
     4  
     5  import (
     6  	"net/http"
     7  	"testing"
     8  	"time"
     9  
    10  	"github.com/stretchr/testify/assert"
    11  )
    12  
    13  func TestNewHTTPClient(t *testing.T) {
    14  	client, _ := NewHTTPClient(Client{
    15  		Timeout:           Duration{Duration: time.Second * 5},
    16  		NotFollowRedirect: true,
    17  		ProxyURL:          "http://127.0.0.1:3128",
    18  	})
    19  
    20  	assert.IsType(t, (*http.Client)(nil), client)
    21  	assert.Equal(t, time.Second*5, client.Timeout)
    22  	assert.NotNil(t, client.CheckRedirect)
    23  }