Skip to content
This repository was archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
Update: accept multiple filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jigordev committed Sep 8, 2024
1 parent 464da4b commit f30d053
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/maia/filter.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ proc check*(f: Filter, req: Request): bool =

proc custom*(f: Filter, validator: Validator): Filter =
result = f
result.validator = proc(req: Request): bool =
if validator(req):
return f.validator(req)
false
result.validator = proc(req: Request): bool = result = if validator(req): f.validator(req) else: false

proc urlContains*(f: Filter, substring: string): Filter =
f.custom(proc(req: Request): bool = substring in $req.uri)
Expand Down

0 comments on commit f30d053

Please sign in to comment.