MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / filter_headers

Function filter_headers

src/environmentd/src/http/webhook.rs:294–309  ·  view source on GitHub ↗
(
    headers: &'a BTreeMap<String, String>,
    filters: &'b WebhookHeaderFilters,
)

Source from the content-addressed store, hash-verified

292}
293
294fn 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///

Callers 3

pack_headerFunction · 0.85

Calls 6

mapMethod · 0.45
filterMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45
containsMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected