Fix #273
This commit is contained in:
parent
8f3dbf7f21
commit
880f7fa62b
@ -1475,7 +1475,7 @@ public:
|
|||||||
if (!callback(buff.data(), buff.size() - strm.avail_out)) { return false; }
|
if (!callback(buff.data(), buff.size() - strm.avail_out)) { return false; }
|
||||||
} while (strm.avail_out == 0);
|
} while (strm.avail_out == 0);
|
||||||
|
|
||||||
return ret == Z_STREAM_END;
|
return ret == Z_OK || ret == Z_STREAM_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
15
test/test.cc
15
test/test.cc
@ -28,6 +28,8 @@ const string LONG_QUERY_URL = "/long-query-value?key=" + LONG_QUERY_VALUE;
|
|||||||
|
|
||||||
const std::string JSON_DATA = "{\"hello\":\"world\"}";
|
const std::string JSON_DATA = "{\"hello\":\"world\"}";
|
||||||
|
|
||||||
|
const string LARGE_DATA = string(1024 * 1024 * 100, '@'); // 100MB
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TEST(StartupTest, WSAStartup) {
|
TEST(StartupTest, WSAStartup) {
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
@ -708,6 +710,11 @@ protected:
|
|||||||
EXPECT_EQ(req.body, "PUT");
|
EXPECT_EQ(req.body, "PUT");
|
||||||
res.set_content(req.body, "text/plain");
|
res.set_content(req.body, "text/plain");
|
||||||
})
|
})
|
||||||
|
.Put("/put-large",
|
||||||
|
[&](const Request &req, Response &res) {
|
||||||
|
EXPECT_EQ(req.body, LARGE_DATA);
|
||||||
|
res.set_content(req.body, "text/plain");
|
||||||
|
})
|
||||||
.Patch("/patch",
|
.Patch("/patch",
|
||||||
[&](const Request &req, Response &res) {
|
[&](const Request &req, Response &res) {
|
||||||
EXPECT_EQ(req.body, "PATCH");
|
EXPECT_EQ(req.body, "PATCH");
|
||||||
@ -1418,6 +1425,14 @@ TEST_F(ServerTest, PutWithContentProviderWithGzip) {
|
|||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
EXPECT_EQ("PUT", res->body);
|
EXPECT_EQ("PUT", res->body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ServerTest, PutLargeFileWithGzip) {
|
||||||
|
auto res = cli_.Put("/put-large", LARGE_DATA, "text/plain", true);
|
||||||
|
|
||||||
|
ASSERT_TRUE(res != nullptr);
|
||||||
|
EXPECT_EQ(200, res->status);
|
||||||
|
EXPECT_EQ(LARGE_DATA, res->body);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_F(ServerTest, Patch) {
|
TEST_F(ServerTest, Patch) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user