Make creation of http.Client uniform across the codebase (#3097)

This commit is contained in:
Martin Angers
2021-11-24 15:56:54 -05:00
committed by GitHub
parent 964f85b174
commit c997f853e5
33 changed files with 279 additions and 90 deletions
+2 -3
View File
@@ -9,6 +9,7 @@ import (
"net/http"
"time"
"github.com/fleetdm/fleet/v4/pkg/fleethttp"
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
)
@@ -44,9 +45,7 @@ func NewKafkaRESTWriter(p *KafkaRESTParams) (*kafkaRESTProducer, error) {
producer := &kafkaRESTProducer{
URL: fmt.Sprintf(krPublishTopicURL, p.KafkaProxyHost, p.KafkaTopic),
CheckURL: fmt.Sprintf(krCheckTopicURL, p.KafkaProxyHost, p.KafkaTopic),
client: &http.Client{
Timeout: time.Duration(p.KafkaTimeout) * time.Second,
},
client: fleethttp.NewClient(fleethttp.WithTimeout(time.Duration(p.KafkaTimeout) * time.Second)),
}
return producer, producer.checkTopic()