diff options
author | metamuffin <metamuffin@disroot.org> | 2024-08-12 20:49:47 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-08-12 20:49:47 +0200 |
commit | ef8172874f650078e8cfb6e1582de4ece5495640 (patch) | |
tree | 35ced9080db86739904e903a68999fd1606bc9b1 /src/modules/switch.rs | |
parent | b28c5418b0635bf2fc3b0d18922df4ebb7cccd57 (diff) | |
download | gnix-ef8172874f650078e8cfb6e1582de4ece5495640.tar gnix-ef8172874f650078e8cfb6e1582de4ece5495640.tar.bz2 gnix-ef8172874f650078e8cfb6e1582de4ece5495640.tar.zst |
add any/all conditions and experimental CGI support
Diffstat (limited to 'src/modules/switch.rs')
-rw-r--r-- | src/modules/switch.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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<Condition>), + All(Vec<Condition>), 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)), } } } |