Fixes #231: added checks to getline calls in parse functions so that they can be used outside the Server/Client classes

This commit is contained in:
eidheim 2018-07-04 20:47:47 +02:00
commit 8b75c14aef
2 changed files with 30 additions and 10 deletions

View file

@ -203,6 +203,31 @@ int main() {
}
}
{
SimpleWeb::CaseInsensitiveMultimap solution;
std::stringstream header;
auto parsed = SimpleWeb::HttpHeader::parse(header);
assert(parsed == solution);
}
{
SimpleWeb::CaseInsensitiveMultimap solution = {{"Content-Type", "application/json"}};
std::stringstream header("Content-Type: application/json");
auto parsed = SimpleWeb::HttpHeader::parse(header);
assert(parsed == solution);
}
{
SimpleWeb::CaseInsensitiveMultimap solution = {{"Content-Type", "application/json"}};
std::stringstream header("Content-Type: application/json\r");
auto parsed = SimpleWeb::HttpHeader::parse(header);
assert(parsed == solution);
}
{
SimpleWeb::CaseInsensitiveMultimap solution = {{"Content-Type", "application/json"}};
std::stringstream header("Content-Type: application/json\r\n");
auto parsed = SimpleWeb::HttpHeader::parse(header);
assert(parsed == solution);
}
{
{
SimpleWeb::CaseInsensitiveMultimap solution;