mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Remove too many debug messages
This commit is contained in:
@@ -26,11 +26,6 @@ func WithUserContextMiddleware(next http.Handler) http.Handler {
|
||||
UserRole: claims.Role,
|
||||
}
|
||||
|
||||
log.Debug("user context extracted from claims",
|
||||
"userID", claims.UserID,
|
||||
"role", claims.Role,
|
||||
"path", r.URL.Path)
|
||||
|
||||
r = WithHandlerContext(r, hctx)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
@@ -58,12 +53,6 @@ func WithWorkspaceContextMiddleware(db db.WorkspaceReader) func(http.Handler) ht
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug("workspace context added",
|
||||
"userID", ctx.UserID,
|
||||
"workspaceID", workspace.ID,
|
||||
"workspaceName", workspace.Name,
|
||||
"path", r.URL.Path)
|
||||
|
||||
ctx.Workspace = workspace
|
||||
r = WithHandlerContext(r, ctx)
|
||||
next.ServeHTTP(w, r)
|
||||
|
||||
@@ -89,6 +89,10 @@ func TestWithUserContextMiddleware(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type contextKey string
|
||||
|
||||
const workspaceNameKey contextKey = "workspaceName"
|
||||
|
||||
func TestWithWorkspaceContextMiddleware(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -158,7 +162,7 @@ func TestWithWorkspaceContextMiddleware(t *testing.T) {
|
||||
}
|
||||
|
||||
// Add workspace name to request context via chi URL params
|
||||
req = req.WithContext(stdctx.WithValue(req.Context(), "workspaceName", tt.workspaceName))
|
||||
req = req.WithContext(stdctx.WithValue(req.Context(), workspaceNameKey, tt.workspaceName))
|
||||
|
||||
nextCalled := false
|
||||
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user