@@ -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))
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user