mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Fixed #26
This commit is contained in:
parent
e90244e992
commit
9bc2883090
2 changed files with 133 additions and 37 deletions
27
test/test.cc
27
test/test.cc
|
@ -109,6 +109,33 @@ TEST(GetHeaderValueTest, RegularValueInt)
|
|||
EXPECT_EQ(100, val);
|
||||
}
|
||||
|
||||
void testChunkedEncoding(httplib::HttpVersion ver)
|
||||
{
|
||||
auto host = "www.httpwatch.com";
|
||||
auto port = 80;
|
||||
|
||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||
httplib::SSLClient cli(host, port, ver);
|
||||
#else
|
||||
httplib::Client cli(host, port, ver);
|
||||
#endif
|
||||
|
||||
auto res = cli.get("/httpgallery/chunked/chunkedimage.aspx?0.4153841143030137");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
|
||||
std::string out;
|
||||
httplib::detail::read_file("./image.jpg", out);
|
||||
|
||||
EXPECT_EQ(200, res->status);
|
||||
EXPECT_EQ(out, res->body);
|
||||
}
|
||||
|
||||
TEST(ChunkedEncodingTest, FromHTTPWatch)
|
||||
{
|
||||
testChunkedEncoding(httplib::HttpVersion::v1_0);
|
||||
testChunkedEncoding(httplib::HttpVersion::v1_1);
|
||||
}
|
||||
|
||||
class ServerTest : public ::testing::Test {
|
||||
protected:
|
||||
ServerTest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue