package handlers import ( "net/http" "github.com/orchard9/rdev/internal/auth" "github.com/orchard9/rdev/internal/domain" ) // testAdminAuth is a chi middleware that injects an admin API key into the // request context so auth.RequireScope passes in tests. func testAdminAuth(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := auth.WithAPIKey(r.Context(), &domain.APIKey{ Scopes: []domain.Scope{domain.ScopeAdmin}, }) next.ServeHTTP(w, r.WithContext(ctx)) }) }