Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-25 15:07:06 +01:00
parent d24712344e
commit 812de537f9

View File

@@ -57,12 +57,14 @@ func FromContext(ctx context.Context) *Loaders {
func NewMiddleware(proboSvc *probo.Service, iamSvc *iam.Service) func(http.Handler) http.Handler { func NewMiddleware(proboSvc *probo.Service, iamSvc *iam.Service) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(
f := &batchFetcher{probo: proboSvc, iam: iamSvc} func(w http.ResponseWriter, r *http.Request) {
loaders := f.newLoaders() f := &batchFetcher{probo: proboSvc, iam: iamSvc}
ctx := context.WithValue(r.Context(), loadersKey, loaders) loaders := f.newLoaders()
next.ServeHTTP(w, r.WithContext(ctx)) ctx := context.WithValue(r.Context(), loadersKey, loaders)
}) next.ServeHTTP(w, r.WithContext(ctx))
},
)
} }
} }