can GET some pages
This commit is contained in:
@ -13,7 +13,25 @@ using namespace ix;
|
||||
void run(const std::string& url)
|
||||
{
|
||||
HttpClient httpClient;
|
||||
httpClient.get(url);
|
||||
bool verbose = true;
|
||||
auto out = httpClient.get(url, verbose);
|
||||
auto errorCode = std::get<0>(out);
|
||||
auto headers = std::get<1>(out);
|
||||
auto payload = std::get<2>(out);
|
||||
auto errorMsg = std::get<3>(out);
|
||||
|
||||
for (auto it : headers)
|
||||
{
|
||||
std::cout << it.first << ": " << it.second << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "error code: " << errorCode << std::endl;
|
||||
if (!errorMsg.empty())
|
||||
{
|
||||
std::cout << "error message: " << errorMsg << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "payload: " << payload << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user