leyline-http 0.1.0

HTTP client that mimics browsers on the wire
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::borrow::Cow;

use crate::util::sensitive_header;

pub(crate) fn masked<'a>(
    fields: impl Iterator<Item = (&'a str, &'a [u8])>,
) -> Vec<(&'a str, Cow<'a, str>)> {
    fields
        .map(|(name, value)| {
            let shown = if sensitive_header(name) {
                Cow::Borrowed("***")
            } else {
                String::from_utf8_lossy(value)
            };
            (name, shown)
        })
        .collect()
}