From ef8172874f650078e8cfb6e1582de4ece5495640 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 12 Aug 2024 20:49:47 +0200 Subject: add any/all conditions and experimental CGI support --- src/modules/switch.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/modules/switch.rs') diff --git a/src/modules/switch.rs b/src/modules/switch.rs index bbb9e98..943a81d 100644 --- a/src/modules/switch.rs +++ b/src/modules/switch.rs @@ -47,6 +47,8 @@ impl Node for Switch { #[derive(Deserialize)] #[serde(rename_all = "snake_case")] enum Condition { + Any(Vec), + All(Vec), IsWebsocketUpgrade, IsPost, IsGet, @@ -66,6 +68,8 @@ impl Condition { Condition::PathIs(path) => req.uri().path() == path, Condition::IsPost => req.method() == Method::POST, Condition::IsGet => req.method() == Method::GET, + Condition::Any(conds) => conds.iter().any(|c| c.test(req)), + Condition::All(conds) => conds.iter().all(|c| c.test(req)), } } } -- cgit v1.2.3-70-g09d2