Added extra test: check if the stream version of the client request methods works if called first

This commit is contained in:
eidheim 2016-11-26 10:45:17 +01:00
commit 302f980cf3

View file

@ -38,6 +38,7 @@ int main() {
}); });
this_thread::sleep_for(chrono::seconds(1)); this_thread::sleep_for(chrono::seconds(1));
{
HttpClient client("localhost:8080"); HttpClient client("localhost:8080");
{ {
@ -68,6 +69,26 @@ int main() {
output << r->content.rdbuf(); output << r->content.rdbuf();
assert(output.str()=="123"); assert(output.str()=="123");
} }
}
{
HttpClient client("localhost:8080");
// test performing the stream version of the request methods first
{
stringstream output;
stringstream content("A string");
auto r=client.request("POST", "/string", content);
output << r->content.rdbuf();
assert(output.str()=="A string");
}
{
stringstream output;
auto r=client.request("POST", "/string", "A string");
output << r->content.rdbuf();
assert(output.str()=="A string");
}
}
server.stop(); server.stop();
server_thread.join(); server_thread.join();