From 9ef0dd6915316afd32693014d3447731e292a68a Mon Sep 17 00:00:00 2001 From: Alessandro Caprarelli Date: Thu, 14 Oct 2021 09:51:01 +0200 Subject: [PATCH] added a comment on the possible http messages --- reqwest-retry/tests/all/retry.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reqwest-retry/tests/all/retry.rs b/reqwest-retry/tests/all/retry.rs index a1b6bd5..9bfcbf3 100644 --- a/reqwest-retry/tests/all/retry.rs +++ b/reqwest-retry/tests/all/retry.rs @@ -217,6 +217,15 @@ async fn assert_retry_on_request_timeout() { #[tokio::test] async fn assert_retry_on_incomplete_message() { + // Following the HTTP/1.1 specification (https://en.wikipedia.org/wiki/HTTP_message_body) a valid response contains: + // - status line + // - headers + // - empty line + // - optional message body + // + // After a few tries we have noticed that: + // - "message_that_makes_no_sense" triggers a hyper::ParseError because the format is completely wrong + // - "HTTP/1.1" triggers a hyper::IncompleteMessage because the format is correct until that point but misses mandatory parts let incomplete_message = "HTTP/1.1"; let complete_message = "HTTP/1.1 200 OK\r\n\r\n";