forked from boostorg/beast
Rename to BEAST_EXPECT
This commit is contained in:
+227
-227
@@ -81,13 +81,13 @@ public:
|
||||
{
|
||||
{
|
||||
fields f;
|
||||
BOOST_BEAST_EXPECT(f.begin() == f.end());
|
||||
BEAST_EXPECT(f.begin() == f.end());
|
||||
}
|
||||
{
|
||||
unequal_t a1;
|
||||
basic_fields<unequal_t> f{a1};
|
||||
BOOST_BEAST_EXPECT(f.get_allocator() == a1);
|
||||
BOOST_BEAST_EXPECT(f.get_allocator() != unequal_t{});
|
||||
BEAST_EXPECT(f.get_allocator() == a1);
|
||||
BEAST_EXPECT(f.get_allocator() != unequal_t{});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,13 +95,13 @@ public:
|
||||
{
|
||||
{
|
||||
basic_fields<equal_t> f1;
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator()->nmove == 0);
|
||||
BEAST_EXPECT(f1.get_allocator()->nmove == 0);
|
||||
f1.insert("1", "1");
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
basic_fields<equal_t> f2{std::move(f1)};
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator()->nmove == 1);
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "");
|
||||
BEAST_EXPECT(f2.get_allocator()->nmove == 1);
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1["1"] == "");
|
||||
}
|
||||
// allocators equal
|
||||
{
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
f1.insert("1", "1");
|
||||
equal_t a;
|
||||
basic_fields<equal_t> f2{std::move(f1), a};
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1["1"] == "");
|
||||
}
|
||||
{
|
||||
// allocators unequal
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
f1.insert("1", "1");
|
||||
unequal_t a;
|
||||
basic_fields<unequal_t> f2{std::move(f1), a};
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,34 +128,34 @@ public:
|
||||
basic_fields<equal_t> f1;
|
||||
f1.insert("1", "1");
|
||||
basic_fields<equal_t> f2{f1};
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() == f2.get_allocator());
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.get_allocator() == f2.get_allocator());
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
basic_fields<unequal_t> f1;
|
||||
f1.insert("1", "1");
|
||||
unequal_t a;
|
||||
basic_fields<unequal_t> f2(f1, a);
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() != f2.get_allocator());
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.get_allocator() != f2.get_allocator());
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
basic_fields<equal_t> f1;
|
||||
f1.insert("1", "1");
|
||||
basic_fields<unequal_t> f2(f1);
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
basic_fields<unequal_t> f1;
|
||||
f1.insert("1", "1");
|
||||
equal_t a;
|
||||
basic_fields<equal_t> f2(f1, a);
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator() == a);
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f2.get_allocator() == a);
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@ public:
|
||||
f1.insert("1", "1");
|
||||
fields f2;
|
||||
f2 = std::move(f1);
|
||||
BOOST_BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
// propagate_on_container_move_assignment : true
|
||||
@@ -177,8 +177,8 @@ public:
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocma_t> f2;
|
||||
f2 = std::move(f1);
|
||||
BOOST_BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
// propagate_on_container_move_assignment : false
|
||||
@@ -188,8 +188,8 @@ public:
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocma_t> f2;
|
||||
f2 = std::move(f1);
|
||||
BOOST_BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,11 +200,11 @@ public:
|
||||
f1.insert("1", "1");
|
||||
fields f2;
|
||||
f2 = f1;
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
basic_fields<equal_t> f3;
|
||||
f3 = f2;
|
||||
BOOST_BEAST_EXPECT(f3["1"] == "1");
|
||||
BEAST_EXPECT(f3["1"] == "1");
|
||||
}
|
||||
{
|
||||
// propagate_on_container_copy_assignment : true
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocca_t> f2;
|
||||
f2 = f1;
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
{
|
||||
// propagate_on_container_copy_assignment : false
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocca_t> f2;
|
||||
f2 = f1;
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,45 +235,45 @@ public:
|
||||
using pocs_t = test::test_allocator<char,
|
||||
false, true, true, true, true>;
|
||||
pocs_t a1, a2;
|
||||
BOOST_BEAST_EXPECT(a1 != a2);
|
||||
BEAST_EXPECT(a1 != a2);
|
||||
basic_fields<pocs_t> f1{a1};
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocs_t> f2{a2};
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
swap(f1, f2);
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() == a2);
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator() == a1);
|
||||
BOOST_BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.get_allocator() == a2);
|
||||
BEAST_EXPECT(f2.get_allocator() == a1);
|
||||
BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
swap(f1, f2);
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2.begin() == f2.end());
|
||||
BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2.begin() == f2.end());
|
||||
}
|
||||
{
|
||||
// propagate_on_container_swap : false
|
||||
using pocs_t = test::test_allocator<char,
|
||||
true, true, true, false, true>;
|
||||
pocs_t a1, a2;
|
||||
BOOST_BEAST_EXPECT(a1 == a2);
|
||||
BOOST_BEAST_EXPECT(a1.id() != a2.id());
|
||||
BEAST_EXPECT(a1 == a2);
|
||||
BEAST_EXPECT(a1.id() != a2.id());
|
||||
basic_fields<pocs_t> f1{a1};
|
||||
f1.insert("1", "1");
|
||||
basic_fields<pocs_t> f2{a2};
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
BEAST_EXPECT(f1.get_allocator() == a1);
|
||||
BEAST_EXPECT(f2.get_allocator() == a2);
|
||||
swap(f1, f2);
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator().id() == a1.id());
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator().id() == a2.id());
|
||||
BOOST_BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BOOST_BEAST_EXPECT(f2["1"] == "1");
|
||||
BEAST_EXPECT(f1.get_allocator().id() == a1.id());
|
||||
BEAST_EXPECT(f2.get_allocator().id() == a2.id());
|
||||
BEAST_EXPECT(f1.begin() == f1.end());
|
||||
BEAST_EXPECT(f2["1"] == "1");
|
||||
swap(f1, f2);
|
||||
BOOST_BEAST_EXPECT(f1.get_allocator().id() == a1.id());
|
||||
BOOST_BEAST_EXPECT(f2.get_allocator().id() == a2.id());
|
||||
BOOST_BEAST_EXPECT(f1["1"] == "1");
|
||||
BOOST_BEAST_EXPECT(f2.begin() == f2.end());
|
||||
BEAST_EXPECT(f1.get_allocator().id() == a1.id());
|
||||
BEAST_EXPECT(f2.get_allocator().id() == a2.id());
|
||||
BEAST_EXPECT(f1["1"] == "1");
|
||||
BEAST_EXPECT(f2.begin() == f2.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,35 +281,35 @@ public:
|
||||
{
|
||||
fields f;
|
||||
f.insert(field::user_agent, "x");
|
||||
BOOST_BEAST_EXPECT(f.count(field::user_agent));
|
||||
BOOST_BEAST_EXPECT(f.count(to_string(field::user_agent)));
|
||||
BOOST_BEAST_EXPECT(f.count(field::user_agent) == 1);
|
||||
BOOST_BEAST_EXPECT(f.count(to_string(field::user_agent)) == 1);
|
||||
BEAST_EXPECT(f.count(field::user_agent));
|
||||
BEAST_EXPECT(f.count(to_string(field::user_agent)));
|
||||
BEAST_EXPECT(f.count(field::user_agent) == 1);
|
||||
BEAST_EXPECT(f.count(to_string(field::user_agent)) == 1);
|
||||
f.insert(field::user_agent, "y");
|
||||
BOOST_BEAST_EXPECT(f.count(field::user_agent) == 2);
|
||||
BEAST_EXPECT(f.count(field::user_agent) == 2);
|
||||
}
|
||||
}
|
||||
|
||||
void testHeaders()
|
||||
{
|
||||
f_t f1;
|
||||
BOOST_BEAST_EXPECT(empty(f1));
|
||||
BEAST_EXPECT(empty(f1));
|
||||
fill(1, f1);
|
||||
BOOST_BEAST_EXPECT(size(f1) == 1);
|
||||
BEAST_EXPECT(size(f1) == 1);
|
||||
f_t f2;
|
||||
f2 = f1;
|
||||
BOOST_BEAST_EXPECT(size(f2) == 1);
|
||||
BEAST_EXPECT(size(f2) == 1);
|
||||
f2.insert("2", "2");
|
||||
BOOST_BEAST_EXPECT(std::distance(f2.begin(), f2.end()) == 2);
|
||||
BEAST_EXPECT(std::distance(f2.begin(), f2.end()) == 2);
|
||||
f1 = std::move(f2);
|
||||
BOOST_BEAST_EXPECT(size(f1) == 2);
|
||||
BOOST_BEAST_EXPECT(size(f2) == 0);
|
||||
BEAST_EXPECT(size(f1) == 2);
|
||||
BEAST_EXPECT(size(f2) == 0);
|
||||
f_t f3(std::move(f1));
|
||||
BOOST_BEAST_EXPECT(size(f3) == 2);
|
||||
BOOST_BEAST_EXPECT(size(f1) == 0);
|
||||
BEAST_EXPECT(size(f3) == 2);
|
||||
BEAST_EXPECT(size(f1) == 0);
|
||||
self_assign(f3, std::move(f3));
|
||||
BOOST_BEAST_EXPECT(size(f3) == 2);
|
||||
BOOST_BEAST_EXPECT(f2.erase("Not-Present") == 0);
|
||||
BEAST_EXPECT(size(f3) == 2);
|
||||
BEAST_EXPECT(f2.erase("Not-Present") == 0);
|
||||
}
|
||||
|
||||
void testRFC2616()
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
f.insert("a", "x");
|
||||
f.insert("aa", "y");
|
||||
f.insert("f", "z");
|
||||
BOOST_BEAST_EXPECT(f.count("a") == 2);
|
||||
BEAST_EXPECT(f.count("a") == 2);
|
||||
}
|
||||
|
||||
void testErase()
|
||||
@@ -329,9 +329,9 @@ public:
|
||||
f.insert("a", "x");
|
||||
f.insert("aa", "y");
|
||||
f.insert("f", "z");
|
||||
BOOST_BEAST_EXPECT(size(f) == 4);
|
||||
BEAST_EXPECT(size(f) == 4);
|
||||
f.erase("a");
|
||||
BOOST_BEAST_EXPECT(size(f) == 2);
|
||||
BEAST_EXPECT(size(f) == 2);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -344,21 +344,21 @@ public:
|
||||
f.insert(field::body, 2);
|
||||
f.insert(field::close, 3);
|
||||
f.insert(field::body, 4);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::age);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::body);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::body);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::close);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Body");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "Body");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Close");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3");
|
||||
BOOST_BEAST_EXPECT(f.erase(field::body) == 2);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Close");
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::age);
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::body);
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::body);
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::close);
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Body");
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "Body");
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Close");
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2");
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4");
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3");
|
||||
BEAST_EXPECT(f.erase(field::body) == 2);
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Close");
|
||||
}
|
||||
{
|
||||
// group fields, case insensitive
|
||||
@@ -367,21 +367,21 @@ public:
|
||||
f.insert("ab", 2);
|
||||
f.insert("b", 3);
|
||||
f.insert("AB", 4);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::unknown);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::unknown);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::unknown);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::unknown);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "ab");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "AB");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "b");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3");
|
||||
BOOST_BEAST_EXPECT(f.erase("Ab") == 2);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "b");
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::unknown);
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::unknown);
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::unknown);
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::unknown);
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "ab");
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "AB");
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "b");
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2");
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4");
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3");
|
||||
BEAST_EXPECT(f.erase("Ab") == 2);
|
||||
BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a");
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "b");
|
||||
}
|
||||
{
|
||||
// verify insertion orde
|
||||
@@ -394,14 +394,14 @@ public:
|
||||
f.insert("Dd", 6);
|
||||
f.insert("DD", 7);
|
||||
f.insert( "e", 8);
|
||||
BOOST_BEAST_EXPECT(f.count("dd") == 4);
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "dd");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "dD");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Dd");
|
||||
BOOST_BEAST_EXPECT(std::next(f.begin(), 4)->name_string() == "DD");
|
||||
BEAST_EXPECT(f.count("dd") == 4);
|
||||
BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "dd");
|
||||
BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "dD");
|
||||
BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Dd");
|
||||
BEAST_EXPECT(std::next(f.begin(), 4)->name_string() == "DD");
|
||||
f.set("dd", "-");
|
||||
BOOST_BEAST_EXPECT(f.count("dd") == 1);
|
||||
BOOST_BEAST_EXPECT(f["dd"] == "-");
|
||||
BEAST_EXPECT(f.count("dd") == 1);
|
||||
BEAST_EXPECT(f["dd"] == "-");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,25 +432,25 @@ public:
|
||||
req.method(verb::get);
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::content_length, "0");
|
||||
req.set(field::transfer_encoding, "chunked");
|
||||
req.prepare_payload();
|
||||
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::transfer_encoding, "deflate");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
|
||||
req.set(field::transfer_encoding, "deflate, chunked");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
}
|
||||
|
||||
// GET, sized
|
||||
@@ -461,19 +461,19 @@ public:
|
||||
req.body = 50;
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "");
|
||||
BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "");
|
||||
|
||||
req.set(field::content_length, "0");
|
||||
req.set(field::transfer_encoding, "chunked");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::transfer_encoding, "deflate, chunked");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
}
|
||||
|
||||
// PUT, empty
|
||||
@@ -483,14 +483,14 @@ public:
|
||||
req.method(verb::put);
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req[field::content_length] == "0");
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::content_length, "50");
|
||||
req.set(field::transfer_encoding, "deflate, chunked");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req[field::content_length] == "0");
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
}
|
||||
|
||||
// PUT, sized
|
||||
@@ -501,14 +501,14 @@ public:
|
||||
req.body = 50;
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::content_length, "25");
|
||||
req.set(field::transfer_encoding, "deflate, chunked");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req[field::content_length] == "50");
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
}
|
||||
|
||||
// POST, unsized
|
||||
@@ -518,13 +518,13 @@ public:
|
||||
req.method(verb::post);
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "chunked");
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "chunked");
|
||||
|
||||
req.set(field::transfer_encoding, "deflate");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate, chunked");
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate, chunked");
|
||||
}
|
||||
|
||||
// POST, unsized HTTP/1.0
|
||||
@@ -534,13 +534,13 @@ public:
|
||||
req.method(verb::post);
|
||||
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req.count(field::transfer_encoding) == 0);
|
||||
|
||||
req.set(field::transfer_encoding, "deflate");
|
||||
req.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
BEAST_EXPECT(req.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(req[field::transfer_encoding] == "deflate");
|
||||
}
|
||||
|
||||
// OK, empty
|
||||
@@ -549,14 +549,14 @@ public:
|
||||
res.version = 11;
|
||||
|
||||
res.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.erase(field::content_length);
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
res.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
}
|
||||
|
||||
// OK, sized
|
||||
@@ -566,14 +566,14 @@ public:
|
||||
res.body = 50;
|
||||
|
||||
res.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "50");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.erase(field::content_length);
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
res.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "50");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "50");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
}
|
||||
|
||||
// OK, unsized
|
||||
@@ -582,8 +582,8 @@ public:
|
||||
res.version = 11;
|
||||
|
||||
res.prepare_payload();
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ public:
|
||||
[&](bool v)
|
||||
{
|
||||
res.keep_alive(v);
|
||||
BOOST_BEAST_EXPECT(
|
||||
BEAST_EXPECT(
|
||||
(res.keep_alive() && v) ||
|
||||
(! res.keep_alive() && ! v));
|
||||
};
|
||||
@@ -608,70 +608,70 @@ public:
|
||||
res.erase(field::connection);
|
||||
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "keep-alive");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "keep-alive, close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.erase(field::connection);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
|
||||
res.set(field::connection, "close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
|
||||
res.set(field::connection, "keep-alive");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
|
||||
res.set(field::connection, "keep-alive, close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive");
|
||||
|
||||
auto const test10 =
|
||||
[&](std::string s)
|
||||
{
|
||||
res.set(field::connection, s);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, s + ", close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s + ", close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, s);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s + ", keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == s + ", keep-alive");
|
||||
|
||||
res.set(field::connection, s + ", close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s + ", keep-alive");
|
||||
BEAST_EXPECT(res[field::connection] == s + ", keep-alive");
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive, " + s);
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive, " + s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s+ ", close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive, " + s);
|
||||
BEAST_EXPECT(res[field::connection] == "keep-alive, " + s);
|
||||
};
|
||||
|
||||
test10("foo");
|
||||
@@ -682,70 +682,70 @@ public:
|
||||
|
||||
res.erase(field::connection);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "keep-alive");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.set(field::connection, "keep-alive, close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
BEAST_EXPECT(res.count(field::connection) == 0);
|
||||
|
||||
res.erase(field::connection);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close");
|
||||
BEAST_EXPECT(res[field::connection] == "close");
|
||||
|
||||
res.set(field::connection, "close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close");
|
||||
BEAST_EXPECT(res[field::connection] == "close");
|
||||
|
||||
res.set(field::connection, "keep-alive");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close");
|
||||
BEAST_EXPECT(res[field::connection] == "close");
|
||||
|
||||
res.set(field::connection, "keep-alive, close");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close");
|
||||
BEAST_EXPECT(res[field::connection] == "close");
|
||||
|
||||
auto const test11 =
|
||||
[&](std::string s)
|
||||
{
|
||||
res.set(field::connection, s);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, s + ", close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s);
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s + ", close");
|
||||
keep_alive(true);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s);
|
||||
BEAST_EXPECT(res[field::connection] == s);
|
||||
|
||||
res.set(field::connection, s);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s + ", close");
|
||||
BEAST_EXPECT(res[field::connection] == s + ", close");
|
||||
|
||||
res.set(field::connection, "close, " + s);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close, " + s);
|
||||
BEAST_EXPECT(res[field::connection] == "close, " + s);
|
||||
|
||||
res.set(field::connection, "keep-alive, " + s);
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == s + ", close");
|
||||
BEAST_EXPECT(res[field::connection] == s + ", close");
|
||||
|
||||
res.set(field::connection, "close, " + s + ", keep-alive");
|
||||
keep_alive(false);
|
||||
BOOST_BEAST_EXPECT(res[field::connection] == "close, " + s);
|
||||
BEAST_EXPECT(res[field::connection] == "close, " + s);
|
||||
};
|
||||
|
||||
test11("foo");
|
||||
@@ -756,79 +756,79 @@ public:
|
||||
testContentLength()
|
||||
{
|
||||
response<empty_body> res{status::ok, 11};
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.content_length(0);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
|
||||
res.content_length(100);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BEAST_EXPECT(res[field::content_length] == "100");
|
||||
|
||||
res.content_length(boost::none);
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
res.content_length(0);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
res.content_length(100);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
res.content_length(boost::none);
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
auto const check = [&](std::string s)
|
||||
{
|
||||
res.set(field::transfer_encoding, s);
|
||||
res.content_length(0);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, s);
|
||||
res.content_length(100);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, s);
|
||||
res.content_length(boost::none);
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, s + ", chunked");
|
||||
res.content_length(0);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, s + ", chunked");
|
||||
res.content_length(100);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, s + ", chunked");
|
||||
res.content_length(boost::none);
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == s);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, " + s);
|
||||
res.content_length(0);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
BEAST_EXPECT(res[field::content_length] == "0");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, " + s);
|
||||
res.content_length(100);
|
||||
BOOST_BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
BEAST_EXPECT(res[field::content_length] == "100");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, " + s);
|
||||
res.content_length(boost::none);
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s);
|
||||
};
|
||||
|
||||
check("foo");
|
||||
@@ -843,63 +843,63 @@ public:
|
||||
testChunked()
|
||||
{
|
||||
response<empty_body> res{status::ok, 11};
|
||||
BOOST_BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res.count(field::content_length) == 0);
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
auto const chunked =
|
||||
[&](bool v)
|
||||
{
|
||||
res.chunked(v);
|
||||
BOOST_BEAST_EXPECT(
|
||||
BEAST_EXPECT(
|
||||
(res.chunked() && v) ||
|
||||
(! res.chunked() && ! v));
|
||||
BOOST_BEAST_EXPECT(res.count(
|
||||
BEAST_EXPECT(res.count(
|
||||
field::content_length) == 0);
|
||||
};
|
||||
|
||||
res.erase(field::transfer_encoding);
|
||||
res.set(field::content_length, 32);
|
||||
chunked(true);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
chunked(true);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked");
|
||||
|
||||
res.erase(field::transfer_encoding);
|
||||
res.set(field::content_length, 32);
|
||||
chunked(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
res.set(field::transfer_encoding, "chunked");
|
||||
chunked(false);
|
||||
BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
BEAST_EXPECT(res.count(field::transfer_encoding) == 0);
|
||||
|
||||
|
||||
|
||||
res.set(field::transfer_encoding, "foo");
|
||||
chunked(true);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "foo, chunked");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "foo, chunked");
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, foo");
|
||||
chunked(true);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked");
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, foo, chunked");
|
||||
chunked(true);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked");
|
||||
|
||||
res.set(field::transfer_encoding, "foo, chunked");
|
||||
chunked(false);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "foo");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "foo");
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, foo");
|
||||
chunked(false);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo");
|
||||
|
||||
res.set(field::transfer_encoding, "chunked, foo, chunked");
|
||||
chunked(false);
|
||||
BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo");
|
||||
BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user