mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 20:20:27 +00:00
- Increase logging signal to noise ratio. - Allow to specify the `http.Client` for github requests. (This allows the use of caching http.Clients). - Clean up implementation.
20 lines
384 B
Go
20 lines
384 B
Go
package httpclient
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gomodule/redigo/redis"
|
|
"github.com/gregjones/httpcache"
|
|
redis_cache "github.com/gregjones/httpcache/redis"
|
|
)
|
|
|
|
func NewClient(conn redis.Conn) *http.Client {
|
|
etagCache := redis_cache.NewWithClient(conn)
|
|
tr := httpcache.NewTransport(etagCache)
|
|
return &http.Client{
|
|
Transport: tr,
|
|
Timeout: 10 * time.Second,
|
|
}
|
|
}
|