package middleware import ( "net/http" "github.com/twitchtv/twirp" ) // Twirp adds the needed values to the request context for twirp services. func Twirp(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() ctx, _ = twirp.WithHTTPRequestHeaders(ctx, r.Header) next.ServeHTTP(w, r.WithContext(ctx)) }) }