Skip to content

Commit

Permalink
test: early server response with data (#703)
Browse files Browse the repository at this point in the history
- fix of the test's name after changing it in #634
- additional test that server also sends data frames correctly
  • Loading branch information
DDtKey authored Jul 22, 2023
1 parent 6a75f23 commit 46fb80b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/h2-tests/tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ async fn recv_connection_header() {
}

#[tokio::test]
async fn sends_reset_cancel_when_req_body_is_dropped() {
async fn sends_reset_no_error_when_req_body_is_dropped() {
h2_support::trace_init!();
let (io, mut client) = mock::new();

Expand All @@ -563,8 +563,11 @@ async fn sends_reset_cancel_when_req_body_is_dropped() {
client
.send_frame(frames::headers(1).request("POST", "https://example.com/"))
.await;
// server responded with data before consuming POST-request's body, resulting in `RST_STREAM(NO_ERROR)`.
client.recv_frame(frames::headers(1).response(200)).await;
client.recv_frame(frames::data(1, vec![0; 16384])).await;
client
.recv_frame(frames::headers(1).response(200).eos())
.recv_frame(frames::data(1, vec![0; 16384]).eos())
.await;
client
.recv_frame(frames::reset(1).reason(Reason::NO_ERROR))
Expand All @@ -578,7 +581,8 @@ async fn sends_reset_cancel_when_req_body_is_dropped() {
assert_eq!(req.method(), &http::Method::POST);

let rsp = http::Response::builder().status(200).body(()).unwrap();
stream.send_response(rsp, true).unwrap();
let mut tx = stream.send_response(rsp, false).unwrap();
tx.send_data(vec![0; 16384 * 2].into(), true).unwrap();
}
assert!(srv.next().await.is_none());
};
Expand Down

0 comments on commit 46fb80b

Please sign in to comment.