mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-14 19:03:30 +00:00
Added more unit tests
This commit is contained in:
1 parent
8480850a3f
commit
ba7f9fe4c3
1 file changed
+23
@@ -202,6 +202,29 @@ TEST(RangeTest, FromHTTPBin) {
|
||||
EXPECT_EQ(res->body, "bcdefghijk");
|
||||
EXPECT_EQ(206, res->status);
|
||||
}
|
||||
|
||||
{
|
||||
httplib::Headers headers = {httplib::make_range_header(0, 31)};
|
||||
auto res = cli.Get("/range/32", headers);
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(res->body, "abcdefghijklmnopqrstuvwxyzabcdef");
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
{
|
||||
httplib::Headers headers = {httplib::make_range_header(0)};
|
||||
auto res = cli.Get("/range/32", headers);
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(res->body, "abcdefghijklmnopqrstuvwxyzabcdef");
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
{
|
||||
httplib::Headers headers = {httplib::make_range_header(0, 32)};
|
||||
auto res = cli.Get("/range/32", headers);
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(416, res->status);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ConnectionErrorTest, InvalidHost) {
|
||||
|
||||
Reference in new issue
Block a user