Module aws_smithy_http_server::instrumentation

source ·
Expand description

Provides InstrumentOperation and a variety of helpers structures for dealing with sensitive data. Together they allow compliance with the sensitive trait.

§Example

let request = Request::get("http://localhost/a/b/c/d?bar=hidden")
    .header("header-name-a", "hidden")
    .body(())
    .unwrap();

let request_fmt = RequestFmt::new()
    .header(|name| HeaderMarker {
       value: name == "header-name-a",
       key_suffix: None,
    })
    .query(|name| QueryMarker { key: false, value: name == "bar" })
    .label(|index| index % 2 == 0, None);
let response_fmt = ResponseFmt::new()
    .header(|name| {
        if name.as_str().starts_with("prefix-") {
            HeaderMarker {
                value: true,
                key_suffix: Some("prefix-".len()),
            }
        } else {
            HeaderMarker {
                value: name == "header-name-b",
                key_suffix: None,
            }
        }
    })
    .status_code();
let mut service = InstrumentOperation::new(service, ID)
    .request_fmt(request_fmt)
    .response_fmt(response_fmt);

let _ = service.call(request).await.unwrap();

Modules§

Structs§

Traits§