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:
Camilo Aguilar
2014-05-21 13:13:20 -04:00
parent 5fa2ad8dfd
commit 3e00a37ef5
7 changed files with 154 additions and 122 deletions

View File

@@ -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 {