mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Removed compress
parameter and added compress
method on client
This commit is contained in:
parent
e5827ad16f
commit
afd6d5f9dc
3 changed files with 77 additions and 94 deletions
|
@ -423,6 +423,13 @@ The server applies gzip compression to the following MIME type contents:
|
||||||
* application/xml
|
* application/xml
|
||||||
* application/xhtml+xml
|
* application/xhtml+xml
|
||||||
|
|
||||||
|
### Compress content on client
|
||||||
|
|
||||||
|
```c++
|
||||||
|
cli.compress(true);
|
||||||
|
res = cli.Post("/resource/foo", "...", "text/plain");
|
||||||
|
```
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
152
httplib.h
152
httplib.h
|
@ -657,78 +657,63 @@ public:
|
||||||
std::shared_ptr<Response> Head(const char *path, const Headers &headers);
|
std::shared_ptr<Response> Head(const char *path, const Headers &headers);
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const std::string &body,
|
std::shared_ptr<Response> Post(const char *path, const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, size_t content_length,
|
std::shared_ptr<Response> Post(const char *path, size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const Params ¶ms,
|
std::shared_ptr<Response> Post(const char *path, const Params ¶ms);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
||||||
const Params ¶ms, bool compress = false);
|
const Params ¶ms);
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path,
|
std::shared_ptr<Response> Post(const char *path,
|
||||||
const MultipartFormDataItems &items,
|
const MultipartFormDataItems &items);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
||||||
const MultipartFormDataItems &items,
|
const MultipartFormDataItems &items);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Put(const char *path, const std::string &body,
|
std::shared_ptr<Response> Put(const char *path, const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Put(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Put(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Put(const char *path, size_t content_length,
|
std::shared_ptr<Response> Put(const char *path, size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Put(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Put(const char *path, const Headers &headers,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Patch(const char *path, const std::string &body,
|
std::shared_ptr<Response> Patch(const char *path, const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Patch(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Patch(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Patch(const char *path, size_t content_length,
|
std::shared_ptr<Response> Patch(const char *path, size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Patch(const char *path, const Headers &headers,
|
std::shared_ptr<Response> Patch(const char *path, const Headers &headers,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type);
|
||||||
bool compress = false);
|
|
||||||
|
|
||||||
std::shared_ptr<Response> Delete(const char *path);
|
std::shared_ptr<Response> Delete(const char *path);
|
||||||
|
|
||||||
|
@ -754,9 +739,11 @@ public:
|
||||||
|
|
||||||
void set_read_timeout(time_t sec, time_t usec);
|
void set_read_timeout(time_t sec, time_t usec);
|
||||||
|
|
||||||
|
void set_auth(const char *username, const char *password);
|
||||||
|
|
||||||
void follow_location(bool on);
|
void follow_location(bool on);
|
||||||
|
|
||||||
void set_auth(const char *username, const char *password);
|
void compress(bool on);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool process_request(Stream &strm, const Request &req, Response &res,
|
bool process_request(Stream &strm, const Request &req, Response &res,
|
||||||
|
@ -769,9 +756,10 @@ protected:
|
||||||
size_t keep_alive_max_count_;
|
size_t keep_alive_max_count_;
|
||||||
time_t read_timeout_sec_;
|
time_t read_timeout_sec_;
|
||||||
time_t read_timeout_usec_;
|
time_t read_timeout_usec_;
|
||||||
size_t follow_location_;
|
bool follow_location_;
|
||||||
std::string username_;
|
std::string username_;
|
||||||
std::string password_;
|
std::string password_;
|
||||||
|
bool compress_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
socket_t create_client_socket() const;
|
socket_t create_client_socket() const;
|
||||||
|
@ -784,7 +772,7 @@ private:
|
||||||
const Headers &headers, const std::string &body,
|
const Headers &headers, const std::string &body,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type, bool compress);
|
const char *content_type);
|
||||||
|
|
||||||
virtual bool process_and_close_socket(
|
virtual bool process_and_close_socket(
|
||||||
socket_t sock, size_t request_count,
|
socket_t sock, size_t request_count,
|
||||||
|
@ -3331,7 +3319,8 @@ inline Client::Client(const char *host, int port, time_t timeout_sec)
|
||||||
keep_alive_max_count_(CPPHTTPLIB_KEEPALIVE_MAX_COUNT),
|
keep_alive_max_count_(CPPHTTPLIB_KEEPALIVE_MAX_COUNT),
|
||||||
read_timeout_sec_(CPPHTTPLIB_READ_TIMEOUT_SECOND),
|
read_timeout_sec_(CPPHTTPLIB_READ_TIMEOUT_SECOND),
|
||||||
read_timeout_usec_(CPPHTTPLIB_READ_TIMEOUT_USECOND),
|
read_timeout_usec_(CPPHTTPLIB_READ_TIMEOUT_USECOND),
|
||||||
follow_location_(false) {}
|
follow_location_(false),
|
||||||
|
compress_(false) {}
|
||||||
|
|
||||||
inline Client::~Client() {}
|
inline Client::~Client() {}
|
||||||
|
|
||||||
|
@ -3570,11 +3559,7 @@ inline void Client::write_request(Stream &strm, const Request &req,
|
||||||
inline std::shared_ptr<Response> Client::send_with_content_provider(
|
inline std::shared_ptr<Response> Client::send_with_content_provider(
|
||||||
const char *method, const char *path, const Headers &headers,
|
const char *method, const char *path, const Headers &headers,
|
||||||
const std::string &body, size_t content_length,
|
const std::string &body, size_t content_length,
|
||||||
ContentProvider content_provider, const char *content_type, bool compress) {
|
ContentProvider content_provider, const char *content_type) {
|
||||||
#ifndef CPPHTTPLIB_ZLIB_SUPPORT
|
|
||||||
(void)compress;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Request req;
|
Request req;
|
||||||
req.method = method;
|
req.method = method;
|
||||||
req.headers = headers;
|
req.headers = headers;
|
||||||
|
@ -3583,7 +3568,7 @@ inline std::shared_ptr<Response> Client::send_with_content_provider(
|
||||||
req.headers.emplace("Content-Type", content_type);
|
req.headers.emplace("Content-Type", content_type);
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
||||||
if (compress) {
|
if (compress_) {
|
||||||
if (content_provider) {
|
if (content_provider) {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
while (offset < content_length) {
|
while (offset < content_length) {
|
||||||
|
@ -3771,45 +3756,40 @@ inline std::shared_ptr<Response> Client::Head(const char *path,
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Post(const char *path,
|
inline std::shared_ptr<Response> Client::Post(const char *path,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Post(path, Headers(), body, content_type);
|
||||||
return Post(path, Headers(), body, content_type, compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Post(const char *path, const Headers &headers, const std::string &body,
|
Client::Post(const char *path, const Headers &headers, const std::string &body,
|
||||||
const char *content_type, bool compress) {
|
const char *content_type) {
|
||||||
return send_with_content_provider("POST", path, headers, body, 0, nullptr,
|
return send_with_content_provider("POST", path, headers, body, 0, nullptr,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Post(const char *path, const Params ¶ms, bool compress) {
|
Client::Post(const char *path, const Params ¶ms) {
|
||||||
return Post(path, Headers(), params, compress);
|
return Post(path, Headers(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Post(const char *path,
|
inline std::shared_ptr<Response> Client::Post(const char *path,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Post(path, Headers(), content_length, content_provider, content_type);
|
||||||
return Post(path, Headers(), content_length, content_provider, content_type,
|
|
||||||
compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Post(const char *path, const Headers &headers, size_t content_length,
|
Client::Post(const char *path, const Headers &headers, size_t content_length,
|
||||||
ContentProvider content_provider, const char *content_type,
|
ContentProvider content_provider, const char *content_type) {
|
||||||
bool compress) {
|
|
||||||
return send_with_content_provider("POST", path, headers, std::string(),
|
return send_with_content_provider("POST", path, headers, std::string(),
|
||||||
content_length, content_provider,
|
content_length, content_provider,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Post(const char *path,
|
inline std::shared_ptr<Response> Client::Post(const char *path,
|
||||||
const Headers &headers,
|
const Headers &headers,
|
||||||
const Params ¶ms,
|
const Params ¶ms) {
|
||||||
bool compress) {
|
|
||||||
std::string query;
|
std::string query;
|
||||||
for (auto it = params.begin(); it != params.end(); ++it) {
|
for (auto it = params.begin(); it != params.end(); ++it) {
|
||||||
if (it != params.begin()) { query += "&"; }
|
if (it != params.begin()) { query += "&"; }
|
||||||
|
@ -3818,19 +3798,17 @@ inline std::shared_ptr<Response> Client::Post(const char *path,
|
||||||
query += detail::encode_url(it->second);
|
query += detail::encode_url(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Post(path, headers, query, "application/x-www-form-urlencoded",
|
return Post(path, headers, query, "application/x-www-form-urlencoded");
|
||||||
compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Post(const char *path, const MultipartFormDataItems &items,
|
Client::Post(const char *path, const MultipartFormDataItems &items) {
|
||||||
bool compress) {
|
return Post(path, Headers(), items);
|
||||||
return Post(path, Headers(), items, compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Post(const char *path, const Headers &headers,
|
Client::Post(const char *path, const Headers &headers,
|
||||||
const MultipartFormDataItems &items, bool compress) {
|
const MultipartFormDataItems &items) {
|
||||||
auto boundary = detail::make_multipart_data_boundary();
|
auto boundary = detail::make_multipart_data_boundary();
|
||||||
|
|
||||||
std::string body;
|
std::string body;
|
||||||
|
@ -3852,71 +3830,63 @@ Client::Post(const char *path, const Headers &headers,
|
||||||
body += "--" + boundary + "--\r\n";
|
body += "--" + boundary + "--\r\n";
|
||||||
|
|
||||||
std::string content_type = "multipart/form-data; boundary=" + boundary;
|
std::string content_type = "multipart/form-data; boundary=" + boundary;
|
||||||
return Post(path, headers, body, content_type.c_str(), compress);
|
return Post(path, headers, body, content_type.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Put(const char *path,
|
inline std::shared_ptr<Response> Client::Put(const char *path,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Put(path, Headers(), body, content_type);
|
||||||
return Put(path, Headers(), body, content_type, compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Put(const char *path, const Headers &headers, const std::string &body,
|
Client::Put(const char *path, const Headers &headers, const std::string &body,
|
||||||
const char *content_type, bool compress) {
|
const char *content_type) {
|
||||||
return send_with_content_provider("PUT", path, headers, body, 0, nullptr,
|
return send_with_content_provider("PUT", path, headers, body, 0, nullptr,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Put(const char *path,
|
inline std::shared_ptr<Response> Client::Put(const char *path,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Put(path, Headers(), content_length, content_provider, content_type);
|
||||||
return Put(path, Headers(), content_length, content_provider, content_type,
|
|
||||||
compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Put(const char *path, const Headers &headers, size_t content_length,
|
Client::Put(const char *path, const Headers &headers, size_t content_length,
|
||||||
ContentProvider content_provider, const char *content_type,
|
ContentProvider content_provider, const char *content_type) {
|
||||||
bool compress) {
|
|
||||||
return send_with_content_provider("PUT", path, headers, std::string(),
|
return send_with_content_provider("PUT", path, headers, std::string(),
|
||||||
content_length, content_provider,
|
content_length, content_provider,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Patch(const char *path,
|
inline std::shared_ptr<Response> Client::Patch(const char *path,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Patch(path, Headers(), body, content_type);
|
||||||
return Patch(path, Headers(), body, content_type, compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Patch(const char *path, const Headers &headers, const std::string &body,
|
Client::Patch(const char *path, const Headers &headers, const std::string &body,
|
||||||
const char *content_type, bool compress) {
|
const char *content_type) {
|
||||||
return send_with_content_provider("PATCH", path, headers, body, 0, nullptr,
|
return send_with_content_provider("PATCH", path, headers, body, 0, nullptr,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Patch(const char *path,
|
inline std::shared_ptr<Response> Client::Patch(const char *path,
|
||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type,
|
const char *content_type) {
|
||||||
bool compress) {
|
return Patch(path, Headers(), content_length, content_provider, content_type);
|
||||||
return Patch(path, Headers(), content_length, content_provider, content_type,
|
|
||||||
compress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response>
|
inline std::shared_ptr<Response>
|
||||||
Client::Patch(const char *path, const Headers &headers, size_t content_length,
|
Client::Patch(const char *path, const Headers &headers, size_t content_length,
|
||||||
ContentProvider content_provider, const char *content_type,
|
ContentProvider content_provider, const char *content_type) {
|
||||||
bool compress) {
|
|
||||||
return send_with_content_provider("PATCH", path, headers, std::string(),
|
return send_with_content_provider("PATCH", path, headers, std::string(),
|
||||||
content_length, content_provider,
|
content_length, content_provider,
|
||||||
content_type, compress);
|
content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<Response> Client::Delete(const char *path) {
|
inline std::shared_ptr<Response> Client::Delete(const char *path) {
|
||||||
|
@ -3976,13 +3946,15 @@ inline void Client::set_read_timeout(time_t sec, time_t usec) {
|
||||||
read_timeout_usec_ = usec;
|
read_timeout_usec_ = usec;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Client::follow_location(bool on) { follow_location_ = on; }
|
|
||||||
|
|
||||||
inline void Client::set_auth(const char *username, const char *password) {
|
inline void Client::set_auth(const char *username, const char *password) {
|
||||||
username_ = username;
|
username_ = username;
|
||||||
password_ = password;
|
password_ = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Client::follow_location(bool on) { follow_location_ = on; }
|
||||||
|
|
||||||
|
inline void Client::compress(bool on) { compress_ = on; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SSL Implementation
|
* SSL Implementation
|
||||||
*/
|
*/
|
||||||
|
|
12
test/test.cc
12
test/test.cc
|
@ -1535,12 +1535,13 @@ TEST_F(ServerTest, PutWithContentProvider) {
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
||||||
TEST_F(ServerTest, PutWithContentProviderWithGzip) {
|
TEST_F(ServerTest, PutWithContentProviderWithGzip) {
|
||||||
|
cli_.compress(true);
|
||||||
auto res = cli_.Put(
|
auto res = cli_.Put(
|
||||||
"/put", 3,
|
"/put", 3,
|
||||||
[](size_t /*offset*/, size_t /*length*/, DataSink sink) {
|
[](size_t /*offset*/, size_t /*length*/, DataSink sink) {
|
||||||
sink("PUT", 3);
|
sink("PUT", 3);
|
||||||
},
|
},
|
||||||
"text/plain", true);
|
"text/plain");
|
||||||
|
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
|
@ -1548,7 +1549,8 @@ TEST_F(ServerTest, PutWithContentProviderWithGzip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ServerTest, PutLargeFileWithGzip) {
|
TEST_F(ServerTest, PutLargeFileWithGzip) {
|
||||||
auto res = cli_.Put("/put-large", LARGE_DATA, "text/plain", true);
|
cli_.compress(true);
|
||||||
|
auto res = cli_.Put("/put-large", LARGE_DATA, "text/plain");
|
||||||
|
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
|
@ -1621,7 +1623,8 @@ TEST_F(ServerTest, PostMulitpartFilsContentReceiver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ServerTest, PostContentReceiverGzip) {
|
TEST_F(ServerTest, PostContentReceiverGzip) {
|
||||||
auto res = cli_.Post("/content_receiver", "content", "text/plain", true);
|
cli_.compress(true);
|
||||||
|
auto res = cli_.Post("/content_receiver", "content", "text/plain");
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
ASSERT_EQ(200, res->status);
|
ASSERT_EQ(200, res->status);
|
||||||
ASSERT_EQ("content", res->body);
|
ASSERT_EQ("content", res->body);
|
||||||
|
@ -1802,7 +1805,8 @@ TEST_F(ServerTest, MultipartFormDataGzip) {
|
||||||
{"key2", "--abcdefg123", "", ""},
|
{"key2", "--abcdefg123", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
auto res = cli_.Post("/gzipmultipart", items, true);
|
cli_.compress(true);
|
||||||
|
auto res = cli_.Post("/gzipmultipart", items);
|
||||||
|
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue