mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
@@ -166,7 +166,6 @@ func Contexter() func(next http.Handler) http.Handler {
|
||||
ctx.PageData = map[string]any{}
|
||||
ctx.Data["PageData"] = ctx.PageData
|
||||
|
||||
ctx.Base.SetContextValue(WebContextKey, ctx) // FIXME: this should be removed because NewWebContext should already set it
|
||||
ctx.Csrf = NewCSRFProtector(csrfOpts)
|
||||
|
||||
// get the last flash message from cookie
|
||||
|
@@ -154,9 +154,9 @@ func PackageContexter() func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||
base := NewBaseContext(resp, req)
|
||||
// it is still needed when rendering 500 page in a package handler
|
||||
// FIXME: web Context is still needed when rendering 500 page in a package handler
|
||||
// It should be refactored to use new error handling mechanisms
|
||||
ctx := NewWebContext(base, renderer, nil)
|
||||
ctx.SetContextValue(WebContextKey, ctx) // FIXME: this should be removed because NewWebContext should already set it
|
||||
next.ServeHTTP(ctx.Resp, ctx.Req)
|
||||
})
|
||||
}
|
||||
|
@@ -67,7 +67,6 @@ func MockContext(t *testing.T, reqPath string, opts ...MockContextOption) (*cont
|
||||
|
||||
chiCtx := chi.NewRouteContext()
|
||||
ctx := context.NewWebContext(base, opt.Render, nil)
|
||||
ctx.SetContextValue(context.WebContextKey, ctx) // FIXME: this should be removed because NewWebContext should already set it
|
||||
ctx.SetContextValue(chi.RouteCtxKey, chiCtx)
|
||||
if opt.SessionStore != nil {
|
||||
ctx.SetContextValue(session.MockStoreContextKey, opt.SessionStore)
|
||||
|
Reference in New Issue
Block a user