Introduce dummy program to help with API releases.

This commit is contained in:
jregan
2019-10-07 21:21:12 -07:00
committed by Jeffrey Regan
parent c1d20546ec
commit 78d14d0d75
110 changed files with 135 additions and 101 deletions

View File

@@ -0,0 +1,23 @@
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,
}
}