-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
22 lines (18 loc) · 705 Bytes
/
Copy pathmain.cpp
File metadata and controls
22 lines (18 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include "Example.h"
#include "NetCxx.h"
using namespace std;
int main() {
Example example;
cout << example.getVersion() << endl;
NetCxx net;
auto response = net.get("http://example.com");
cout << "Response code: " << response.response_code << endl;
cout << "Response body: " << response.body << endl;
cout << "Response error: " << response.error << endl;
response = net.post("http://example.com/login", "{\"user_name\":\"user\",\"password\":\"pass\"}");
cout << "Response code: " << response.response_code << endl;
cout << "Response body: " << response.body << endl;
cout << "Response error: " << response.error << endl;
return 0;
}