Files
Marwan Sulaiman 5870aeee8d Remove Buffalo (#1010)
* Remove Buffalo

* gofmt

* pr fixes

* fix subrouter

* bring back secure middleware + pr fixes

* better place for subrouter

* vendor
2018-12-22 20:24:25 -05:00

21 lines
501 B
Go

package middleware
import (
"net/http"
"github.com/gorilla/mux"
)
// CacheControl takes a string and makes a header value to the key Cache-Control.
// This is so you can set some sane cache defaults to certain endpoints.
func CacheControl(cacheHeaderValue string) mux.MiddlewareFunc {
return func(h http.Handler) http.Handler {
f := func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", cacheHeaderValue)
h.ServeHTTP(w, r)
}
return http.HandlerFunc(f)
}
}