Hi,
II just found you library and would like to implement an reserve proxy with HTTP caching but the example in the bench_test.go dies not work. I expect that the payload is cached.
backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Cache-Control", "max-age=100000")
fmt.Fprintf(w, "cache server payload")
fmt.Print("Inbound\n")
}))
defer backend.Close()
u, err := url.Parse(backend.URL)
if err != nil {
panic(err)
}
handler := httpcache.NewHandler(httpcache.NewMemoryCache(), httputil.NewSingleHostReverseProxy(u))
handler.Shared = true
cacheServer := httptest.NewServer(handler)
defer cacheServer.Close()
for n := 0; n < 5; n++ {
client := http.Client{}
resp, err := client.Get(fmt.Sprintf("%s/llamas/%d", cacheServer.URL, n))
if err != nil {
panic(err)
}
resp.Body.Close()
}
Hi, II just found you library and would like to implement an reserve proxy with HTTP caching but the example in the
bench_test.go
dies not work. I expect that the payload is cached.