Skip to content

Commit

Permalink
use methodAsEnum() in endpoint and json example
Browse files Browse the repository at this point in the history
  • Loading branch information
renerocksai committed Feb 24, 2024
1 parent 8a18a02 commit 77f5fd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/hello_json/hello_json.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 77f5fd0

Please sign in to comment.