Added extra test: check if the stream version of the client request methods works if called first
This commit is contained in:
parent
ddb5622f76
commit
302f980cf3
1 changed files with 46 additions and 25 deletions
|
|
@ -38,35 +38,56 @@ int main() {
|
|||
});
|
||||
|
||||
this_thread::sleep_for(chrono::seconds(1));
|
||||
HttpClient client("localhost:8080");
|
||||
|
||||
{
|
||||
stringstream output;
|
||||
auto r=client.request("POST", "/string", "A string");
|
||||
output << r->content.rdbuf();
|
||||
assert(output.str()=="A string");
|
||||
}
|
||||
HttpClient client("localhost:8080");
|
||||
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
{
|
||||
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("GET", "/info", "", {{"Test Parameter", "test value"}});
|
||||
output << r->content.rdbuf();
|
||||
assert(output.str()=="GET /info 1.1 test value");
|
||||
}
|
||||
|
||||
{
|
||||
stringstream output;
|
||||
auto r=client.request("GET", "/match/123");
|
||||
output << r->content.rdbuf();
|
||||
assert(output.str()=="123");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
stringstream output;
|
||||
auto r=client.request("GET", "/info", "", {{"Test Parameter", "test value"}});
|
||||
output << r->content.rdbuf();
|
||||
assert(output.str()=="GET /info 1.1 test value");
|
||||
}
|
||||
|
||||
{
|
||||
stringstream output;
|
||||
auto r=client.request("GET", "/match/123");
|
||||
output << r->content.rdbuf();
|
||||
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue