You've already forked cpp-httplib
Better error handling on client (#601)
This commit is contained in:
@ -17,12 +17,12 @@ int main(void) {
|
||||
auto scheme_host_port = "http://localhost:8080";
|
||||
#endif
|
||||
|
||||
auto res = httplib::Client(scheme_host_port).Get("/hi");
|
||||
|
||||
if (res) {
|
||||
if (auto res = httplib::Client(scheme_host_port).Get("/hi")) {
|
||||
cout << res->status << endl;
|
||||
cout << res->get_header_value("Content-Type") << endl;
|
||||
cout << res->body << endl;
|
||||
} else {
|
||||
cout << res.error() << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user