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

EndpointHandler: de-morgan logic for useRoutes

from !a or b -> a and b
This commit is contained in:
Rene Schallner 2024-10-14 23:18:19 +02:00
parent 9a80747cdd
commit 9543ede15f
No known key found for this signature in database

View file

@ -99,7 +99,7 @@ pub fn EndpointHandler(comptime HandlerType: anytype, comptime ContextType: anyt
pub fn onRequest(handler: *HandlerType, r: zap.Request, context: *ContextType) bool {
const self: *Self = @fieldParentPtr("handler", handler);
r.setUserContext(context);
if (!self.options.checkPath or
if (self.options.checkPath and
std.mem.startsWith(u8, r.path orelse "", self.endpoint.settings.path))
{
self.endpoint.onRequest(r);