Test get_header() with umlauts.
This commit is contained in:
parent
63a14867c3
commit
dbfee4c2bd
|
@ -3,6 +3,7 @@
|
|||
#include <catch.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
namespace curl_wrapper
|
||||
|
@ -22,17 +23,18 @@ Keep-Alive: timeout=20
|
|||
Expires: Sat, 07 Nov 2020 22:56:13 GMT
|
||||
Cache-Control: max-age=1800
|
||||
X-Cache: HIT
|
||||
X-UmläÜt: 🙂
|
||||
)";
|
||||
const string searchfor{"cache-control"};
|
||||
|
||||
bool exception = false;
|
||||
string value;
|
||||
|
||||
WHEN("We search for " + searchfor)
|
||||
std::locale::global(std::locale("de_DE.UTF-8"));
|
||||
|
||||
WHEN("We search for “cache-control”")
|
||||
{
|
||||
try
|
||||
{
|
||||
value = ret.get_header(searchfor);
|
||||
value = ret.get_header("cache-control");
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
|
@ -46,6 +48,25 @@ X-Cache: HIT
|
|||
REQUIRE(value == "max-age=1800");
|
||||
}
|
||||
}
|
||||
|
||||
WHEN("We search for “X-UMLÄÜT”")
|
||||
{
|
||||
try
|
||||
{
|
||||
value = ret.get_header("X-UMLÄÜT");
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
exception = true;
|
||||
}
|
||||
|
||||
THEN("No exception is thrown")
|
||||
AND_THEN("The value is successfully extracted")
|
||||
{
|
||||
REQUIRE_FALSE(exception);
|
||||
REQUIRE(value == "🙂");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace curl_wrapper
|
||||
|
|
Loading…
Reference in New Issue
Block a user