Simplified simplecli.cc
This commit is contained in:
parent
342c3ab293
commit
6cde600922
@ -8,20 +8,17 @@
|
|||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define CA_CERT_FILE "./ca-bundle.crt"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
auto res = httplib::Client2("https://localhost:8080")
|
auto scheme_host_port = "https://localhost:8080";
|
||||||
.set_ca_cert_path(CA_CERT_FILE)
|
|
||||||
// .enable_server_certificate_verification(true)
|
|
||||||
.Get("/hi");
|
|
||||||
#else
|
#else
|
||||||
auto res = httplib::Client2("http://localhost:8080").Get("/hi");
|
auto scheme_host_port = "http://localhost:8080";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
auto res = httplib::Client2(scheme_host_port).Get("/hi");
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
cout << res->status << endl;
|
cout << res->status << endl;
|
||||||
cout << res->get_header_value("Content-Type") << endl;
|
cout << res->get_header_value("Content-Type") << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user