@@ -5302,11 +5302,13 @@ TEST_F(ServerTest, PatchContentReceiver) {
53025302 ASSERT_EQ (" content" , res->body );
53035303}
53045304
5305- template <typename ClientType>
5305+ template <typename ClientType>
53065306void TestWithHeadersAndContentReceiver (
5307- ClientType& cli,
5308- std::function<Result(ClientType&, const std::string&, const Headers&, const std::string&, const std::string&,
5309- ContentReceiver, DownloadProgress)> request_func) {
5307+ ClientType &cli,
5308+ std::function<Result(ClientType &, const std::string &, const Headers &,
5309+ const std::string &, const std::string &,
5310+ ContentReceiver, DownloadProgress)>
5311+ request_func) {
53105312 Headers headers;
53115313 headers.emplace (" X-Custom-Header" , " test-value" );
53125314
@@ -5316,7 +5318,8 @@ void TestWithHeadersAndContentReceiver(
53165318 [&](const char *data, size_t data_length) {
53175319 received_body.append (data, data_length);
53185320 return true ;
5319- }, nullptr );
5321+ },
5322+ nullptr );
53205323
53215324 ASSERT_TRUE (res);
53225325 EXPECT_EQ (StatusCode::OK_200, res->status );
@@ -5329,11 +5332,12 @@ TEST_F(ServerTest, PostWithHeadersAndContentReceiver) {
53295332#else
53305333 using ClientT = Client;
53315334#endif
5332- TestWithHeadersAndContentReceiver<ClientT>(cli_,
5333- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5334- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5335- return cli.Post (path, headers, body, content_type, receiver, progress);
5336- });
5335+ TestWithHeadersAndContentReceiver<ClientT>(
5336+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5337+ const std::string &body, const std::string &content_type,
5338+ ContentReceiver receiver, DownloadProgress progress) {
5339+ return cli.Post (path, headers, body, content_type, receiver, progress);
5340+ });
53375341}
53385342
53395343TEST_F (ServerTest, PutWithHeadersAndContentReceiver) {
@@ -5342,11 +5346,12 @@ TEST_F(ServerTest, PutWithHeadersAndContentReceiver) {
53425346#else
53435347 using ClientT = Client;
53445348#endif
5345- TestWithHeadersAndContentReceiver<ClientT>(cli_,
5346- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5347- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5348- return cli.Put (path, headers, body, content_type, receiver, progress);
5349- });
5349+ TestWithHeadersAndContentReceiver<ClientT>(
5350+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5351+ const std::string &body, const std::string &content_type,
5352+ ContentReceiver receiver, DownloadProgress progress) {
5353+ return cli.Put (path, headers, body, content_type, receiver, progress);
5354+ });
53505355}
53515356
53525357TEST_F (ServerTest, PatchWithHeadersAndContentReceiver) {
@@ -5355,18 +5360,21 @@ TEST_F(ServerTest, PatchWithHeadersAndContentReceiver) {
53555360#else
53565361 using ClientT = Client;
53575362#endif
5358- TestWithHeadersAndContentReceiver<ClientT>(cli_,
5359- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5360- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5361- return cli.Patch (path, headers, body, content_type, receiver, progress);
5362- });
5363+ TestWithHeadersAndContentReceiver<ClientT>(
5364+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5365+ const std::string &body, const std::string &content_type,
5366+ ContentReceiver receiver, DownloadProgress progress) {
5367+ return cli.Patch (path, headers, body, content_type, receiver, progress);
5368+ });
53635369}
53645370
5365- template <typename ClientType>
5371+ template <typename ClientType>
53665372void TestWithHeadersAndContentReceiverWithProgress (
5367- ClientType& cli,
5368- std::function<Result(ClientType&, const std::string&, const Headers&, const std::string&, const std::string&,
5369- ContentReceiver, DownloadProgress)> request_func) {
5373+ ClientType &cli,
5374+ std::function<Result(ClientType &, const std::string &, const Headers &,
5375+ const std::string &, const std::string &,
5376+ ContentReceiver, DownloadProgress)>
5377+ request_func) {
53705378 Headers headers;
53715379 headers.emplace (" X-Test-Header" , " progress-test" );
53725380
@@ -5396,11 +5404,12 @@ TEST_F(ServerTest, PostWithHeadersAndContentReceiverWithProgress) {
53965404#else
53975405 using ClientT = Client;
53985406#endif
5399- TestWithHeadersAndContentReceiverWithProgress<ClientT>(cli_,
5400- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5401- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5402- return cli.Post (path, headers, body, content_type, receiver, progress);
5403- });
5407+ TestWithHeadersAndContentReceiverWithProgress<ClientT>(
5408+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5409+ const std::string &body, const std::string &content_type,
5410+ ContentReceiver receiver, DownloadProgress progress) {
5411+ return cli.Post (path, headers, body, content_type, receiver, progress);
5412+ });
54045413}
54055414
54065415TEST_F (ServerTest, PutWithHeadersAndContentReceiverWithProgress) {
@@ -5409,11 +5418,12 @@ TEST_F(ServerTest, PutWithHeadersAndContentReceiverWithProgress) {
54095418#else
54105419 using ClientT = Client;
54115420#endif
5412- TestWithHeadersAndContentReceiverWithProgress<ClientT>(cli_,
5413- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5414- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5415- return cli.Put (path, headers, body, content_type, receiver, progress);
5416- });
5421+ TestWithHeadersAndContentReceiverWithProgress<ClientT>(
5422+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5423+ const std::string &body, const std::string &content_type,
5424+ ContentReceiver receiver, DownloadProgress progress) {
5425+ return cli.Put (path, headers, body, content_type, receiver, progress);
5426+ });
54175427}
54185428
54195429TEST_F (ServerTest, PatchWithHeadersAndContentReceiverWithProgress) {
@@ -5422,31 +5432,33 @@ TEST_F(ServerTest, PatchWithHeadersAndContentReceiverWithProgress) {
54225432#else
54235433 using ClientT = Client;
54245434#endif
5425- TestWithHeadersAndContentReceiverWithProgress<ClientT>(cli_,
5426- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5427- const std::string& content_type, ContentReceiver receiver, DownloadProgress progress) {
5428- return cli.Patch (path, headers, body, content_type, receiver, progress);
5429- });
5435+ TestWithHeadersAndContentReceiverWithProgress<ClientT>(
5436+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5437+ const std::string &body, const std::string &content_type,
5438+ ContentReceiver receiver, DownloadProgress progress) {
5439+ return cli.Patch (path, headers, body, content_type, receiver, progress);
5440+ });
54305441}
54315442
5432- template <typename ClientType>
5443+ template <typename ClientType>
54335444void TestWithHeadersAndContentReceiverError (
5434- ClientType& cli,
5435- std::function<Result(ClientType&, const std::string&, const Headers&, const std::string&, const std::string&,
5436- ContentReceiver)> request_func) {
5445+ ClientType &cli, std::function<Result(ClientType &, const std::string &,
5446+ const Headers &, const std::string &,
5447+ const std::string &, ContentReceiver)>
5448+ request_func) {
54375449 Headers headers;
54385450 headers.emplace (" X-Error-Test" , " true" );
54395451
54405452 std::string received_body;
54415453 auto receiver_failed = false ;
54425454
5443- auto res = request_func (
5444- cli, " /content_receiver" , headers, " content" , " text/plain" ,
5445- [&](const char *data, size_t data_length) {
5446- received_body.append (data, data_length);
5447- receiver_failed = true ;
5448- return false ;
5449- });
5455+ auto res =
5456+ request_func ( cli, " /content_receiver" , headers, " content" , " text/plain" ,
5457+ [&](const char *data, size_t data_length) {
5458+ received_body.append (data, data_length);
5459+ receiver_failed = true ;
5460+ return false ;
5461+ });
54505462
54515463 ASSERT_FALSE (res);
54525464 EXPECT_TRUE (receiver_failed);
@@ -5458,11 +5470,12 @@ TEST_F(ServerTest, PostWithHeadersAndContentReceiverError) {
54585470#else
54595471 using ClientT = Client;
54605472#endif
5461- TestWithHeadersAndContentReceiverError<ClientT>(cli_,
5462- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5463- const std::string& content_type, ContentReceiver receiver) {
5464- return cli.Post (path, headers, body, content_type, receiver);
5465- });
5473+ TestWithHeadersAndContentReceiverError<ClientT>(
5474+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5475+ const std::string &body, const std::string &content_type,
5476+ ContentReceiver receiver) {
5477+ return cli.Post (path, headers, body, content_type, receiver);
5478+ });
54665479}
54675480
54685481TEST_F (ServerTest, PuttWithHeadersAndContentReceiverError) {
@@ -5471,11 +5484,12 @@ TEST_F(ServerTest, PuttWithHeadersAndContentReceiverError) {
54715484#else
54725485 using ClientT = Client;
54735486#endif
5474- TestWithHeadersAndContentReceiverError<ClientT>(cli_,
5475- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5476- const std::string& content_type, ContentReceiver receiver) {
5477- return cli.Put (path, headers, body, content_type, receiver);
5478- });
5487+ TestWithHeadersAndContentReceiverError<ClientT>(
5488+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5489+ const std::string &body, const std::string &content_type,
5490+ ContentReceiver receiver) {
5491+ return cli.Put (path, headers, body, content_type, receiver);
5492+ });
54795493}
54805494
54815495TEST_F (ServerTest, PatchWithHeadersAndContentReceiverError) {
@@ -5484,11 +5498,12 @@ TEST_F(ServerTest, PatchWithHeadersAndContentReceiverError) {
54845498#else
54855499 using ClientT = Client;
54865500#endif
5487- TestWithHeadersAndContentReceiverError<ClientT>(cli_,
5488- [](ClientT& cli, const std::string& path, const Headers& headers, const std::string& body,
5489- const std::string& content_type, ContentReceiver receiver) {
5490- return cli.Patch (path, headers, body, content_type, receiver);
5491- });
5501+ TestWithHeadersAndContentReceiverError<ClientT>(
5502+ cli_, [](ClientT &cli, const std::string &path, const Headers &headers,
5503+ const std::string &body, const std::string &content_type,
5504+ ContentReceiver receiver) {
5505+ return cli.Patch (path, headers, body, content_type, receiver);
5506+ });
54925507}
54935508
54945509TEST_F (ServerTest, PostQueryStringAndBody) {
0 commit comments