Allowed HTTP methods for the endpoint in `policy.network_policies[policy_name]` matching `(host, port)`. Returns empty when the rule or endpoint is not found (e.g. SAT path threaded through a stale model).
(
policy: &crate::policy::PolicyModel,
policy_name: &str,
host: &str,
port: u16,
)
| 280 | /// matching `(host, port)`. Returns empty when the rule or endpoint is not |
| 281 | /// found (e.g. SAT path threaded through a stale model). |
| 282 | fn endpoint_allowed_methods_in_rule( |
| 283 | policy: &crate::policy::PolicyModel, |
| 284 | policy_name: &str, |
| 285 | host: &str, |
| 286 | port: u16, |
| 287 | ) -> HashSet<String> { |
| 288 | let Some(rule) = policy.network_policies.get(policy_name) else { |
| 289 | return HashSet::new(); |
| 290 | }; |
| 291 | for ep in &rule.endpoints { |
| 292 | if ep.host.eq_ignore_ascii_case(host) && ep.effective_ports().contains(&port) { |
| 293 | return ep.allowed_methods(); |
| 294 | } |
| 295 | } |
| 296 | HashSet::new() |
| 297 | } |
| 298 | |
| 299 | // --------------------------------------------------------------------------- |
| 300 | // Tests |
no test coverage detected