aws_smithy_runtime::client::http::test_util

Function capture_request

source
pub fn capture_request(
    response: Option<Response<SdkBody>>,
) -> (CaptureRequestHandler, CaptureRequestReceiver)
Available on crate features client and test-util only.
Expand description

Test connection used to capture a single request

If response is None, it will reply with a 200 response with an empty body

Example:

let (capture_client, request) = capture_request(None);
let conf = aws_sdk_sts::Config::builder()
    .http_client(capture_client)
    .build();
let client = aws_sdk_sts::Client::from_conf(conf);
let _ = client.assume_role_with_saml().send().await;
// web identity should be unsigned
assert_eq!(
    request.expect_request().headers().get("AUTHORIZATION"),
    None
);