Skip to content

Commit 31884ec

Browse files
committed
refactor(http/retry): update more Body::data() calls
pr's #3564 and #3567, 1eb822f and 3204278 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 <[email protected]>
1 parent 31d9e8f commit 31884ec

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

linkerd/http/retry/src/replay.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ mod tests {
870870
// alternately, hyperium/http-body#140 adds a channel-backed body to `http-body-util`.
871871
let (mut tx, body) = hyper::Body::channel();
872872
let mut initial = ReplayBody::try_new(body, 8).expect("channel body must not be too large");
873-
let mut replay = initial.clone();
873+
let replay = initial.clone();
874874

875875
// Send enough data to reach the cap
876876
tx.send_data(Bytes::from("aaaaaaaa")).await.unwrap();
@@ -884,11 +884,12 @@ mod tests {
884884

885885
// The request's replay should error, since we discarded the buffer when
886886
// we hit the cap.
887+
let mut replay = crate::compat::ForwardCompatibleBody::new(replay);
887888
let err = replay
888-
.data()
889+
.frame()
889890
.await
890-
.expect("replay must yield Some(Err(..)) when capped")
891-
.expect_err("replay must error when cappped");
891+
.expect("yields a result")
892+
.expect_err("yields an error when capped");
892893
assert!(err.is::<Capped>())
893894
}
894895

@@ -910,7 +911,7 @@ mod tests {
910911
assert_eq!(chunk(&mut initial).await, Some("aaaaaaaa".to_string()));
911912
drop(initial);
912913

913-
let mut replay2 = replay.clone();
914+
let replay2 = replay.clone();
914915

915916
// The replay will reach the cap, but it should still return data from
916917
// the original body.
@@ -920,11 +921,12 @@ mod tests {
920921
drop(replay);
921922

922923
// The second replay will fail, though, because the buffer was discarded.
924+
let mut replay2 = crate::compat::ForwardCompatibleBody::new(replay2);
923925
let err = replay2
924-
.data()
926+
.frame()
925927
.await
926-
.expect("replay must yield Some(Err(..)) when capped")
927-
.expect_err("replay must error when cappped");
928+
.expect("yields a result")
929+
.expect_err("yields an error when capped");
928930
assert!(err.is::<Capped>())
929931
}
930932

0 commit comments

Comments
 (0)