1
0
mirror of synced 2025-04-19 00:24:02 +03:00
cpp-httplib/example/client.cc
2012-10-03 20:11:22 -04:00

31 lines
531 B
C++

//
// client.cc
//
// Copyright (c) 2012 Yuji Hirose. All rights reserved.
// The Boost Software License 1.0
//
#include <httplib.h>
#include <iostream>
using namespace std;
using namespace httplib;
int main(void)
{
const char* hi = "/hi";
Client cli("localhost", 8080);
Response res;
if (cli.get(hi, res)) {
cout << res.status << endl;
cout << res.get_header_value("Content-Type") << endl;
cout << res.body << endl;
}
return 0;
}
// vim: et ts=4 sw=4 cin cino={1s ff=unix