mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
24 lines
474 B
Go
24 lines
474 B
Go
package httpclient
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gomodule/redigo/redis"
|
|
"github.com/gregjones/httpcache"
|
|
rediscache "github.com/gregjones/httpcache/redis"
|
|
)
|
|
|
|
func FromCache(header http.Header) bool {
|
|
return header.Get(httpcache.XFromCache) != ""
|
|
}
|
|
|
|
func NewClient(conn redis.Conn) *http.Client {
|
|
etagCache := rediscache.NewWithClient(conn)
|
|
tr := httpcache.NewTransport(etagCache)
|
|
return &http.Client{
|
|
Transport: tr,
|
|
Timeout: 10 * time.Second,
|
|
}
|
|
}
|