@@ -1361,6 +1361,14 @@ TEST(CancelTest, WithCancelLargePayloadDelete) {
1361
1361
EXPECT_EQ (Error::Canceled, res.error ());
1362
1362
}
1363
1363
1364
+ static std::string remove_whitespace (const std::string &input) {
1365
+ std::string output;
1366
+ output.reserve (input.size ());
1367
+ std::copy_if (input.begin (), input.end (), std::back_inserter (output),
1368
+ [](unsigned char c) { return !std::isspace (c); });
1369
+ return output;
1370
+ }
1371
+
1364
1372
TEST (BaseAuthTest, FromHTTPWatch_Online) {
1365
1373
#ifdef CPPHTTPLIB_DEFAULT_HTTPBIN
1366
1374
auto host = " httpbin.org" ;
@@ -1388,17 +1396,17 @@ TEST(BaseAuthTest, FromHTTPWatch_Online) {
1388
1396
auto res =
1389
1397
cli.Get (path, {make_basic_authentication_header (" hello" , " world" )});
1390
1398
ASSERT_TRUE (res);
1391
- EXPECT_EQ (" {\n \ " authenticated\" : true, \n \ " user\" : \" hello\"\n } \n " ,
1392
- res->body );
1399
+ EXPECT_EQ (" {\" authenticated\" :true,\ " user\" :\" hello\" } " ,
1400
+ remove_whitespace ( res->body ) );
1393
1401
EXPECT_EQ (StatusCode::OK_200, res->status );
1394
1402
}
1395
1403
1396
1404
{
1397
1405
cli.set_basic_auth (" hello" , " world" );
1398
1406
auto res = cli.Get (path);
1399
1407
ASSERT_TRUE (res);
1400
- EXPECT_EQ (" {\n \ " authenticated\" : true, \n \ " user\" : \" hello\"\n } \n " ,
1401
- res->body );
1408
+ EXPECT_EQ (" {\" authenticated\" :true,\ " user\" :\" hello\" } " ,
1409
+ remove_whitespace ( res->body ) );
1402
1410
EXPECT_EQ (StatusCode::OK_200, res->status );
1403
1411
}
1404
1412
@@ -1454,8 +1462,8 @@ TEST(DigestAuthTest, FromHTTPWatch_Online) {
1454
1462
for (const auto &path : paths) {
1455
1463
auto res = cli.Get (path.c_str ());
1456
1464
ASSERT_TRUE (res);
1457
- EXPECT_EQ (" {\n \ " authenticated\" : true, \n \ " user\" : \" hello\"\n } \n " ,
1458
- res->body );
1465
+ EXPECT_EQ (" {\" authenticated\" :true,\ " user\" :\" hello\" } " ,
1466
+ remove_whitespace ( res->body ) );
1459
1467
EXPECT_EQ (StatusCode::OK_200, res->status );
1460
1468
}
1461
1469
0 commit comments