client.cc 489 B

123456789101112131415161718192021222324252627
  1. //
  2. // client.cc
  3. //
  4. // Copyright (c) 2012 Yuji Hirose. All rights reserved.
  5. // The Boost Software License 1.0
  6. //
  7. #include <httplib.h>
  8. #include <iostream>
  9. using namespace std;
  10. int main(void)
  11. {
  12. httplib::Client cli("localhost", 8080);
  13. auto res = cli.get("/hi");
  14. if (res) {
  15. cout << res->status << endl;
  16. cout << res->get_header_value("Content-Type") << endl;
  17. cout << res->body << endl;
  18. }
  19. return 0;
  20. }
  21. // vim: et ts=4 sw=4 cin cino={1s ff=unix