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:
parent
8a18a0258f
commit
77f5fd05b9
2 changed files with 2 additions and 2 deletions
|
@ -7,7 +7,7 @@ const User = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
fn on_request(r: zap.Request) void {
|
fn on_request(r: zap.Request) void {
|
||||||
if (r.method != .GET) return;
|
if (r.methodAsEnum() != .GET) return;
|
||||||
|
|
||||||
// /user/n
|
// /user/n
|
||||||
if (r.path) |the_path| {
|
if (r.path) |the_path| {
|
||||||
|
|
|
@ -60,7 +60,7 @@ fn nop(self: *Endpoint, r: Request) void {
|
||||||
|
|
||||||
/// The global request handler for this Endpoint, called by the listener.
|
/// The global request handler for this Endpoint, called by the listener.
|
||||||
pub fn onRequest(self: *Endpoint, r: zap.Request) void {
|
pub fn onRequest(self: *Endpoint, r: zap.Request) void {
|
||||||
switch (r.method) {
|
switch (r.methodAsEnum()) {
|
||||||
.GET => self.settings.get.?(self, r),
|
.GET => self.settings.get.?(self, r),
|
||||||
.POST => self.settings.post.?(self, r),
|
.POST => self.settings.post.?(self, r),
|
||||||
.PUT => self.settings.put.?(self, r),
|
.PUT => self.settings.put.?(self, r),
|
||||||
|
|
Loading…
Add table
Reference in a new issue