This commit is contained in:
yhirose 2021-01-23 12:23:06 -05:00 committed by GitHub
parent 59f5fdbb33
commit 0308d60cb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 128 additions and 9 deletions

View file

@ -816,6 +816,31 @@ TEST(HttpsToHttpRedirectTest, Redirect) {
EXPECT_EQ(200, res->status);
}
TEST(HttpsToHttpRedirectTest2, Redirect) {
SSLClient cli("nghttp2.org");
cli.set_follow_location(true);
Params params;
params.emplace("url", "http://www.google.com");
params.emplace("status_code", "302");
auto res = cli.Get("/httpbin/redirect-to", params, Headers{});
ASSERT_TRUE(res);
EXPECT_EQ(200, res->status);
}
TEST(HttpsToHttpRedirectTest3, Redirect) {
SSLClient cli("nghttp2.org");
cli.set_follow_location(true);
Params params;
params.emplace("url", "http://www.google.com");
auto res = cli.Get("/httpbin/redirect-to?status_code=302", params, Headers{});
ASSERT_TRUE(res);
EXPECT_EQ(200, res->status);
}
TEST(RedirectToDifferentPort, Redirect) {
Server svr8080;
Server svr8081;
@ -956,9 +981,8 @@ TEST(ErrorHandlerTest, ContentLength) {
TEST(NoContentTest, ContentLength) {
Server svr;
svr.Get("/hi", [](const Request & /*req*/, Response &res) {
res.status = 204;
});
svr.Get("/hi",
[](const Request & /*req*/, Response &res) { res.status = 204; });
auto thread = std::thread([&]() { svr.listen(HOST, PORT); });
// Give GET time to get a few messages.
@ -3979,7 +4003,7 @@ TEST(DecodeWithChunkedEncoding, BrotliEncoding) {
}
#endif
TEST(HttpsToHttpRedirectTest2, SimpleInterface) {
TEST(HttpsToHttpRedirectTest, SimpleInterface) {
Client cli("https://nghttp2.org");
cli.set_follow_location(true);
auto res =
@ -3989,4 +4013,29 @@ TEST(HttpsToHttpRedirectTest2, SimpleInterface) {
ASSERT_TRUE(res);
EXPECT_EQ(200, res->status);
}
TEST(HttpsToHttpRedirectTest2, SimpleInterface) {
Client cli("https://nghttp2.org");
cli.set_follow_location(true);
Params params;
params.emplace("url", "http://www.google.com");
params.emplace("status_code", "302");
auto res = cli.Get("/httpbin/redirect-to", params, Headers{});
ASSERT_TRUE(res);
EXPECT_EQ(200, res->status);
}
TEST(HttpsToHttpRedirectTest3, SimpleInterface) {
Client cli("https://nghttp2.org");
cli.set_follow_location(true);
Params params;
params.emplace("url", "http://www.google.com");
auto res = cli.Get("/httpbin/redirect-to?status_code=302", params, Headers{});
ASSERT_TRUE(res);
EXPECT_EQ(200, res->status);
}
#endif