From 77f5fd05b945f66f1dea9c9e40cd09dec7b317b6 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Sat, 24 Feb 2024 15:52:27 +0100 Subject: [PATCH] use methodAsEnum() in endpoint and json example --- examples/hello_json/hello_json.zig | 2 +- src/endpoint.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/hello_json/hello_json.zig b/examples/hello_json/hello_json.zig index cdbc51f..4361e28 100644 --- a/examples/hello_json/hello_json.zig +++ b/examples/hello_json/hello_json.zig @@ -7,7 +7,7 @@ const User = struct { }; fn on_request(r: zap.Request) void { - if (r.method != .GET) return; + if (r.methodAsEnum() != .GET) return; // /user/n if (r.path) |the_path| { diff --git a/src/endpoint.zig b/src/endpoint.zig index 3903809..c4ba86b 100644 --- a/src/endpoint.zig +++ b/src/endpoint.zig @@ -60,7 +60,7 @@ fn nop(self: *Endpoint, r: Request) void { /// The global request handler for this Endpoint, called by the listener. pub fn onRequest(self: *Endpoint, r: zap.Request) void { - switch (r.method) { + switch (r.methodAsEnum()) { .GET => self.settings.get.?(self, r), .POST => self.settings.post.?(self, r), .PUT => self.settings.put.?(self, r),