Don't panic when a user isn't in context
1 files changed, 1 insertions(+), 2 deletions(-) M auth/middleware.go
M auth/middleware.go +1 -2
@@ 2,7 2,6 @@ package auth import ( "context" - "errors" "fmt" "net/http" "net/url" @@ 28,7 27,7 @@ func Context(ctx context.Context, user g func ForContext(ctx context.Context) gobwebs.User { user, ok := ctx.Value(userCtxKey).(gobwebs.User) if !ok { - panic(errors.New("invalid user context")) + return nil } return user }