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:
parent
a330627b09
commit
fa4acdf954
2 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue