feat(util/http_client): Adds generic HTTP client
Supports retries with exponential backoff as well as connection timeouts and the ability to skip SSL/TLS verification. This commit also refactors datasource and initialize packages in order to use the new HTTP client.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package datasource
|
||||
|
||||
import "github.com/coreos/coreos-cloudinit/util"
|
||||
|
||||
type metadataService struct {
|
||||
url string
|
||||
}
|
||||
@@ -9,7 +11,8 @@ func NewMetadataService(url string) *metadataService {
|
||||
}
|
||||
|
||||
func (ms *metadataService) Fetch() ([]byte, error) {
|
||||
return fetchURL(ms.url)
|
||||
client := util.NewHttpClient()
|
||||
return client.Get(ms.url)
|
||||
}
|
||||
|
||||
func (ms *metadataService) Type() string {
|
||||
|
Reference in New Issue
Block a user