(
headers: &'a BTreeMap<String, String>,
filters: &'b WebhookHeaderFilters,
)
| 292 | } |
| 293 | |
| 294 | fn filter_headers<'a: 'b, 'b>( |
| 295 | headers: &'a BTreeMap<String, String>, |
| 296 | filters: &'b WebhookHeaderFilters, |
| 297 | ) -> impl Iterator<Item = (&'a str, &'a str)> + 'b { |
| 298 | headers |
| 299 | .iter() |
| 300 | .filter(|(header_name, _val)| { |
| 301 | // If our block list is empty, then don't filter anything. |
| 302 | filters.block.is_empty() || !filters.block.contains(*header_name) |
| 303 | }) |
| 304 | .filter(|(header_name, _val)| { |
| 305 | // If our allow list is empty, then don't filter anything. |
| 306 | filters.allow.is_empty() || filters.allow.contains(*header_name) |
| 307 | }) |
| 308 | .map(|(key, val)| (key.as_str(), val.as_str())) |
| 309 | } |
| 310 | |
| 311 | /// A [`Row`] that has the body of a request already packed into it. |
| 312 | /// |
no test coverage detected