yttopodcast/bouncer/middle.go
HeshamTB a33b90c5c7
init: tools and commands
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2024-06-09 14:04:22 +03:00

16 lines
387 B
Go

package bouncer
import (
"context"
"net/http"
"gitea.hbanafa.com/hesham/yttopodcast/ytlinkprov"
)
func UrlCache(next http.Handler, url_prov ytlinkprov.YtLinkProvider) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
rr := r.WithContext(context.WithValue(r.Context(), CTX_LINKPROV, url_prov))
next.ServeHTTP(w, rr)
})
}