mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
Revert Context changes in middleware_with_endpoint by fixing middleware MixContexts
This commit is contained in:
parent
1559fbd2c3
commit
c047d9dc9b
2 changed files with 5 additions and 5 deletions
|
@ -20,10 +20,10 @@ const SharedAllocator = struct {
|
|||
};
|
||||
|
||||
// create a combined context struct
|
||||
const Context = struct {
|
||||
user: ?UserMiddleWare.User = null,
|
||||
session: ?SessionMiddleWare.Session = null,
|
||||
};
|
||||
const Context = zap.Middleware.MixContexts(.{
|
||||
.{ .name = "?user", .type = UserMiddleWare.User },
|
||||
.{ .name = "?session", .type = SessionMiddleWare.Session },
|
||||
});
|
||||
|
||||
// we create a Handler type based on our Context
|
||||
const Handler = zap.Middleware.Handler(Context);
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn MixContexts(comptime context_tuple: anytype) type {
|
|||
fields[i] = .{
|
||||
.name = fieldName,
|
||||
.type = fieldType,
|
||||
.default_value = if (isOptional) &null else null,
|
||||
.default_value = if (isOptional) &@as(fieldType, null) else null,
|
||||
.is_comptime = false,
|
||||
.alignment = 0,
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue