1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

fix router constness for current zig

This commit is contained in:
Rene Schallner 2024-01-24 14:10:07 +01:00
parent a330627b09
commit fa4acdf954
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{ var gpa = std.heap.GeneralPurposeAllocator(.{
.thread_safe = true, .thread_safe = true,
}){}; }){};
var allocator = gpa.allocator(); const allocator = gpa.allocator();
var simpleRouter = zap.Router.init(allocator, .{ var simpleRouter = zap.Router.init(allocator, .{
.not_found = not_found, .not_found = not_found,

View file

@ -45,7 +45,7 @@ pub fn handle_func(self: *Self, path: []const u8, h: zap.HttpRequestFn) !void {
pub fn serve(self: *Self, r: zap.Request) void { pub fn serve(self: *Self, r: zap.Request) void {
const path = if (r.path) |p| p else "/"; const path = if (r.path) |p| p else "/";
var route = self.routes.get(path); const route = self.routes.get(path);
if (route) |handler| { if (route) |handler| {
handler(r); handler(r);