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),