From 31884ec97909b955905e3346d8f0c473d19284cf Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Tue, 28 Jan 2025 00:00:00 +0000 Subject: [PATCH] refactor(http/retry): update more `Body::data()` calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pr's #3564 and #3567, 1eb822f2 and 32042783 respectively, replaced uses of defunct `http_body::Body` trait methods — namely, `data()` and `trailers()`. this commit updates two remaining uses of `data()` that were missed in this initial pass. see linkerd/linkerd2#8733 for more information. Signed-off-by: katelyn martin --- linkerd/http/retry/src/replay.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/linkerd/http/retry/src/replay.rs b/linkerd/http/retry/src/replay.rs index 11eb53aa41..8f397ca7fa 100644 --- a/linkerd/http/retry/src/replay.rs +++ b/linkerd/http/retry/src/replay.rs @@ -870,7 +870,7 @@ mod tests { // alternately, hyperium/http-body#140 adds a channel-backed body to `http-body-util`. let (mut tx, body) = hyper::Body::channel(); let mut initial = ReplayBody::try_new(body, 8).expect("channel body must not be too large"); - let mut replay = initial.clone(); + let replay = initial.clone(); // Send enough data to reach the cap tx.send_data(Bytes::from("aaaaaaaa")).await.unwrap(); @@ -884,11 +884,12 @@ mod tests { // The request's replay should error, since we discarded the buffer when // we hit the cap. + let mut replay = crate::compat::ForwardCompatibleBody::new(replay); let err = replay - .data() + .frame() .await - .expect("replay must yield Some(Err(..)) when capped") - .expect_err("replay must error when cappped"); + .expect("yields a result") + .expect_err("yields an error when capped"); assert!(err.is::()) } @@ -910,7 +911,7 @@ mod tests { assert_eq!(chunk(&mut initial).await, Some("aaaaaaaa".to_string())); drop(initial); - let mut replay2 = replay.clone(); + let replay2 = replay.clone(); // The replay will reach the cap, but it should still return data from // the original body. @@ -920,11 +921,12 @@ mod tests { drop(replay); // The second replay will fail, though, because the buffer was discarded. + let mut replay2 = crate::compat::ForwardCompatibleBody::new(replay2); let err = replay2 - .data() + .frame() .await - .expect("replay must yield Some(Err(..)) when capped") - .expect_err("replay must error when cappped"); + .expect("yields a result") + .expect_err("yields an error when capped"); assert!(err.is::()) }