Remove too many debug messages

This commit is contained in:
2024-12-19 22:00:42 +01:00
parent 0aa67f5cc2
commit b065938211
26 changed files with 75 additions and 586 deletions

View File

@@ -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)

View File

@@ -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) {