From 104f2c7649adc9d9b17aaf007e01f296e7840444 Mon Sep 17 00:00:00 2001 From: flopetautschnig <69145145+floscodes@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:48:39 +0200 Subject: [PATCH] Update server.zig --- src/server.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server.zig b/src/server.zig index a8999a0..d06a07c 100644 --- a/src/server.zig +++ b/src/server.zig @@ -58,9 +58,12 @@ pub const Server = struct { var req_path = r[0]; // Trim a possible trailing slash from Route path in order to accept it during the matching process. if (req_path.len > 1) req_path = std.mem.trimRight(u8, req_path, "/"); + // Check if there is a match if (eql(u8, req_path, req.uri)) { - // If URI matches, change response with handling function. + // Change response with handling function in case of match. res = r[1](req); + // Exit loop in case of match + break; } } // Stringify the Response and send it to the client.