@@ -86,12 +86,28 @@ INSTANTIATE_TEST_SUITE_P(HttpStatusMessageTest, HttpStatusMessageFormattingTest,
8686 HttpStatusCodeWithString{ services::HttpStatusCode::UnsupportedMediaType, " UnsupportedMediaType" },
8787 HttpStatusCodeWithString{ services::HttpStatusCode::RequestRangeNotSatisfiable, " RequestRangeNotSatisfiable" },
8888 HttpStatusCodeWithString{ services::HttpStatusCode::ExpectationFailed, " ExpectationFailed" },
89+ HttpStatusCodeWithString{ services::HttpStatusCode::MisdirectedRequest, " MisdirectedRequest" },
90+ HttpStatusCodeWithString{ services::HttpStatusCode::UnprocessableContent, " UnprocessableContent" },
91+ HttpStatusCodeWithString{ services::HttpStatusCode::Locked, " Locked" },
92+ HttpStatusCodeWithString{ services::HttpStatusCode::FailedDependency, " FailedDependency" },
93+ HttpStatusCodeWithString{ services::HttpStatusCode::TooEarly, " TooEarly" },
94+ HttpStatusCodeWithString{ services::HttpStatusCode::UpgradeRequired, " UpgradeRequired" },
95+ HttpStatusCodeWithString{ services::HttpStatusCode::PreconditionRequired, " PreconditionRequired" },
96+ HttpStatusCodeWithString{ services::HttpStatusCode::TooManyRequests, " TooManyRequests" },
97+ HttpStatusCodeWithString{ services::HttpStatusCode::RequestHeaderFieldsTooLarge, " RequestHeaderFieldsTooLarge" },
98+ HttpStatusCodeWithString{ services::HttpStatusCode::UnavailableForLegalReasons, " UnavailableForLegalReasons" },
8999 HttpStatusCodeWithString{ services::HttpStatusCode::InternalServerError, " InternalServerError" },
90100 HttpStatusCodeWithString{ services::HttpStatusCode::NotImplemented, " NotImplemented" },
91101 HttpStatusCodeWithString{ services::HttpStatusCode::BadGateway, " BadGateway" },
92102 HttpStatusCodeWithString{ services::HttpStatusCode::ServiceUnavailable, " ServiceUnavailable" },
93103 HttpStatusCodeWithString{ services::HttpStatusCode::GatewayTimeOut, " GatewayTimeOut" },
94- HttpStatusCodeWithString{ services::HttpStatusCode::HttpVersionNotSupported, " HttpVersionNotSupported" }));
104+ HttpStatusCodeWithString{ services::HttpStatusCode::HttpVersionNotSupported, " HttpVersionNotSupported" },
105+ HttpStatusCodeWithString{ services::HttpStatusCode::VariantAlsoNegotiates, " VariantAlsoNegotiates" },
106+ HttpStatusCodeWithString{ services::HttpStatusCode::InsufficientStorage, " InsufficientStorage" },
107+ HttpStatusCodeWithString{ services::HttpStatusCode::LoopDetected, " LoopDetected" },
108+ HttpStatusCodeWithString{ services::HttpStatusCode::NotExtended, " NotExtended" },
109+ HttpStatusCodeWithString{ services::HttpStatusCode::NetworkAuthenticationRequired, " NetworkAuthenticationRequired" },
110+ HttpStatusCodeWithString{ static_cast <services::HttpStatusCode>(900 ), " Unknown HTTP status: 900" }));
95111
96112struct HttpStatusCodeAndString
97113{
@@ -149,12 +165,27 @@ INSTANTIATE_TEST_SUITE_P(HttpStatusMessageTest, HttpStatusMessageParsingTest,
149165 HttpStatusCodeAndString{ " 415" , services::HttpStatusCode::UnsupportedMediaType },
150166 HttpStatusCodeAndString{ " 416" , services::HttpStatusCode::RequestRangeNotSatisfiable },
151167 HttpStatusCodeAndString{ " 417" , services::HttpStatusCode::ExpectationFailed },
168+ HttpStatusCodeAndString{ " 421" , services::HttpStatusCode::MisdirectedRequest },
169+ HttpStatusCodeAndString{ " 422" , services::HttpStatusCode::UnprocessableContent },
170+ HttpStatusCodeAndString{ " 423" , services::HttpStatusCode::Locked },
171+ HttpStatusCodeAndString{ " 424" , services::HttpStatusCode::FailedDependency },
172+ HttpStatusCodeAndString{ " 425" , services::HttpStatusCode::TooEarly },
173+ HttpStatusCodeAndString{ " 426" , services::HttpStatusCode::UpgradeRequired },
174+ HttpStatusCodeAndString{ " 428" , services::HttpStatusCode::PreconditionRequired },
175+ HttpStatusCodeAndString{ " 429" , services::HttpStatusCode::TooManyRequests },
176+ HttpStatusCodeAndString{ " 431" , services::HttpStatusCode::RequestHeaderFieldsTooLarge },
177+ HttpStatusCodeAndString{ " 451" , services::HttpStatusCode::UnavailableForLegalReasons },
152178 HttpStatusCodeAndString{ " 500" , services::HttpStatusCode::InternalServerError },
153179 HttpStatusCodeAndString{ " 501" , services::HttpStatusCode::NotImplemented },
154180 HttpStatusCodeAndString{ " 502" , services::HttpStatusCode::BadGateway },
155181 HttpStatusCodeAndString{ " 503" , services::HttpStatusCode::ServiceUnavailable },
156182 HttpStatusCodeAndString{ " 504" , services::HttpStatusCode::GatewayTimeOut },
157- HttpStatusCodeAndString{ " 505" , services::HttpStatusCode::HttpVersionNotSupported }));
183+ HttpStatusCodeAndString{ " 505" , services::HttpStatusCode::HttpVersionNotSupported },
184+ HttpStatusCodeAndString{ " 506" , services::HttpStatusCode::VariantAlsoNegotiates },
185+ HttpStatusCodeAndString{ " 507" , services::HttpStatusCode::InsufficientStorage },
186+ HttpStatusCodeAndString{ " 508" , services::HttpStatusCode::LoopDetected },
187+ HttpStatusCodeAndString{ " 510" , services::HttpStatusCode::NotExtended },
188+ HttpStatusCodeAndString{ " 511" , services::HttpStatusCode::NetworkAuthenticationRequired }));
158189
159190class HttpClientTest
160191 : public testing::Test
@@ -410,15 +441,13 @@ TEST_F(HttpClientTest, incorrect_response_version_should_not_call_StatusAvailabl
410441 connection.SimulateDataReceived (infra::StringAsByteRange (infra::BoundedConstString (" HTTP/X.Y 200 Success\r\n " )));
411442}
412443
413- TEST_F (HttpClientTest, incorrect_response_code_should_not_call_StatusAvailable )
444+ TEST_F (HttpClientTest, unexpected_response_code_should_call_StatusAvailable )
414445{
415446 Connect ();
416447
417- EXPECT_CALL (client, StatusAvailable (testing::_)). Times ( 0 );
448+ EXPECT_CALL (client, StatusAvailable (static_cast <services::HttpStatusCode>( 900 )) );
418449
419450 EXPECT_CALL (connection, AckReceivedMock ());
420- EXPECT_CALL (connection, AbortAndDestroyMock ());
421- EXPECT_CALL (client, Detaching ());
422451 client.Subject ().Get (" /" );
423452 ExecuteAllActions ();
424453 connection.SimulateDataReceived (infra::StringAsByteRange (infra::BoundedConstString (" HTTP/1.1 900 Invalid\r\n " )));
0 commit comments