mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 12:27:44 +02:00
Empty header values are allowed & documented.
This commit is contained in:
committed by
Klemens Morgenstern
parent
541a6bf453
commit
01dd53d665
@ -421,6 +421,7 @@ public:
|
||||
If one or more fields with the same name already exist,
|
||||
the new field will be inserted after the last field with
|
||||
the matching name, in serialization order.
|
||||
The value can be an empty string.
|
||||
|
||||
@param name The field name.
|
||||
|
||||
@ -439,6 +440,7 @@ public:
|
||||
If one or more fields with the same name already exist,
|
||||
the new field will be inserted after the last field with
|
||||
the matching name, in serialization order.
|
||||
The value can be an empty string.
|
||||
|
||||
@param name The field name.
|
||||
|
||||
@ -457,6 +459,7 @@ public:
|
||||
If one or more fields with the same name already exist,
|
||||
the new field will be inserted after the last field with
|
||||
the matching name, in serialization order.
|
||||
The value can be an empty string.
|
||||
|
||||
@param name The field name.
|
||||
|
||||
@ -477,13 +480,14 @@ public:
|
||||
/** Set a field value, removing any other instances of that field.
|
||||
|
||||
First removes any values with matching field names, then
|
||||
inserts the new field value.
|
||||
inserts the new field value. The value may be an empty string.
|
||||
|
||||
@param name The field name.
|
||||
|
||||
@param value The value of the field, as a @ref boost::beast::string_view
|
||||
|
||||
@return The field value.
|
||||
|
||||
*/
|
||||
void
|
||||
set(field name, string_view const& value);
|
||||
@ -494,7 +498,7 @@ public:
|
||||
/** Set a field value, removing any other instances of that field.
|
||||
|
||||
First removes any values with matching field names, then
|
||||
inserts the new field value.
|
||||
inserts the new field value. The value can be an empty string.
|
||||
|
||||
@param name The field name.
|
||||
|
||||
|
@ -1072,6 +1072,20 @@ public:
|
||||
BOOST_STATIC_ASSERT(( insert_test<string_view, const char(&)[10]>::value));
|
||||
}
|
||||
|
||||
void
|
||||
testEmpty()
|
||||
{
|
||||
beast::http::fields req;
|
||||
req.insert("abc", "");
|
||||
req.set("cba", "");
|
||||
auto itr = req.find("abc");
|
||||
BEAST_EXPECT(itr != req.end());
|
||||
BEAST_EXPECT(itr->value().empty());
|
||||
itr = req.find("cba");
|
||||
BEAST_EXPECT(itr != req.end());
|
||||
BEAST_EXPECT(itr->value().empty());
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@ -1089,6 +1103,7 @@ public:
|
||||
|
||||
testIssue1828();
|
||||
boost::ignore_unused(&fields_test::testIssue2085);
|
||||
testEmpty();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user