-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
28 lines (23 loc) · 851 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include "includes/CLI11.hpp"
#include "http_client.hpp"
int main(int argc, char **argv)
{
CLI::App app;
std::string url;
std::string verb;
std::string data;
std::vector<std::string> headers;
bool verbose;
app.add_flag("-v, --verbose", verbose, "Dump complete request and response");
app.add_option("-X, --request", verb, "specify request method to use")
->default_val("GET")
->check(CLI::IsMember({"GET", "POST", "PUT", "DELETE"}));
app.add_option("-d, --data", data, "Add data to the request body");
app.add_option("-H, --header", headers, "Pass custom header(s) to server");
app.add_option("url", url, "url")->required();
CLI11_PARSE(app, argc, argv);
Http_Client client(url);
std::cout << client.send(verb, &data, &headers, verbose);
return 0;
}