Skip to main content

compare_responses

Function compare_responses 

Source
pub fn compare_responses(
    baseline: impl IntoResponseSnapshot,
    current: impl IntoResponseSnapshot,
) -> ResponseDiff
Examples found in repository?
examples/basic_diff.rs (line 14)
4fn main() {
5    let baseline = ResponseSnapshot::new(200, vec![("Server", "nginx")], "hello world")
6        .with_elapsed(Duration::from_millis(80));
7    let probe = ResponseSnapshot::new(
8        500,
9        vec![("Server", "envoy"), ("X-Blocked", "1")],
10        "request blocked",
11    )
12    .with_elapsed(Duration::from_millis(240));
13
14    let diff = compare_responses(baseline, probe);
15    println!("status_changed={}", diff.status_changed);
16    println!("significant={}", is_differential_match(&diff));
17}