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

use methodAsEnum() in endpoint and json example

This commit is contained in:
Rene Schallner 2024-02-24 15:52:27 +01:00
parent 8a18a0258f
commit 77f5fd05b9
2 changed files with 2 additions and 2 deletions

View file

@ -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| {

View file

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