Add minimal HTTP GET test

The test does a request and prints the responses. It is done to see that
the functionality works. Also added a timeout of 10 seconds to both the
connection and data transfer phases.
This commit is contained in:
Markus Mäkelä
2018-08-19 08:02:04 +03:00
parent f8fb9510c9
commit 934600f8fc
2 changed files with 18 additions and 0 deletions

View File

@ -170,10 +170,25 @@ int test_checksums()
return 0;
}
void test_http()
{
auto res = mxs::http::get("https://mariadb.com/");
std::cout << "https://mariadb.com/ responded with: " << res.code << std::endl;
if (res.code == 200)
{
if (res.headers.count("Date"))
{
std::cout << "The date is: " << res.headers["Date"] << std::endl;
}
}
}
int main(int argc, char* argv[])
{
int rv = 0;
test_http(); // Just to see that it works
rv += test_trim();
rv += test_trim_leading();
rv += test_trim_trailing();