From 9a663aa94e005434c0e7dc2cc21eef2d11485c24 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 21 Feb 2020 11:48:47 -0500 Subject: [PATCH] Added a unit test. --- test/test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test.cc b/test/test.cc index 95c4c93..9b78c6c 100644 --- a/test/test.cc +++ b/test/test.cc @@ -1041,6 +1041,16 @@ TEST_F(ServerTest, GetMethod200) { EXPECT_EQ("Hello World!", res->body); } +TEST_F(ServerTest, GetMethod200withPercentEncoding) { + auto res = cli_.Get("/%68%69"); // auto res = cli_.Get("/hi"); + ASSERT_TRUE(res != nullptr); + EXPECT_EQ("HTTP/1.1", res->version); + EXPECT_EQ(200, res->status); + EXPECT_EQ("text/plain", res->get_header_value("Content-Type")); + EXPECT_EQ(1, res->get_header_value_count("Content-Type")); + EXPECT_EQ("Hello World!", res->body); +} + TEST_F(ServerTest, GetMethod302) { auto res = cli_.Get("/"); ASSERT_TRUE(res != nullptr);