@@ -70,10 +70,10 @@ using namespace lklibs;
7070
7171int main () {
7272
73- HttpClient httpClient ;
73+ HttpRequest httpRequest ;
7474
7575 // The simplest but slowest method if multiple calls will be made
76- auto response = httpClient .getRequest("https://api.myproject.com?param1=7¶m2=test").get();
76+ auto response = httpRequest .getRequest("https://api.myproject.com?param1=7¶m2=test").get();
7777
7878 std::cout << "Succeed: " << response.succeed << std::endl;
7979 std::cout << "Http Status Code: " << response.statusCode << std::endl;
@@ -98,13 +98,13 @@ using namespace lklibs;
9898
9999int main () {
100100
101- HttpClient httpClient ;
101+ HttpRequest httpRequest ;
102102
103- auto response1 = httpClient .getRequest("https://api.myproject.com/foo").get();
104- auto response2 = httpClient .getRequest("https://api.myproject.com/bar").get();
105- auto response3 = httpClient .getRequest("https://api.myproject.com/baz").get();
106- auto response4 = httpClient .getRequest("https://api.myproject.com/qux").get();
107- auto response5 = httpClient .getRequest("https://api.myproject.com/quux").get();
103+ auto response1 = httpRequest .getRequest("https://api.myproject.com/foo").get();
104+ auto response2 = httpRequest .getRequest("https://api.myproject.com/bar").get();
105+ auto response3 = httpRequest .getRequest("https://api.myproject.com/baz").get();
106+ auto response4 = httpRequest .getRequest("https://api.myproject.com/qux").get();
107+ auto response5 = httpRequest .getRequest("https://api.myproject.com/quux").get();
108108
109109 // Takes 2.5 seconds in total
110110
@@ -124,13 +124,13 @@ using namespace lklibs;
124124
125125int main () {
126126
127- HttpClient httpClient ;
127+ HttpRequest httpRequest ;
128128
129- auto future1 = httpClient .getRequest("https://api.myproject.com/foo");
130- auto future2 = httpClient .getRequest("https://api.myproject.com/bar");
131- auto future3 = httpClient .getRequest("https://api.myproject.com/baz");
132- auto future4 = httpClient .getRequest("https://api.myproject.com/qux");
133- auto future5 = httpClient .getRequest("https://api.myproject.com/quux");
129+ auto future1 = httpRequest .getRequest("https://api.myproject.com/foo");
130+ auto future2 = httpRequest .getRequest("https://api.myproject.com/bar");
131+ auto future3 = httpRequest .getRequest("https://api.myproject.com/baz");
132+ auto future4 = httpRequest .getRequest("https://api.myproject.com/qux");
133+ auto future5 = httpRequest .getRequest("https://api.myproject.com/quux");
134134
135135 auto response1 = future1.get();
136136 auto response2 = future2.get();
@@ -166,9 +166,9 @@ using namespace lklibs;
166166
167167int main () {
168168
169- HttpClient httpClient ;
169+ HttpRequest httpRequest ;
170170
171- auto response = httpClient .getRequest("https://www.myinvalidurl.com").get();
171+ auto response = httpRequest .getRequest("https://www.myinvalidurl.com").get();
172172
173173 // Instead of throwing an exception, the succeed field of the response object is set to false
174174 std::cout << "Succeed: " << response.succeed << std::endl;
@@ -200,10 +200,10 @@ using namespace lklibs;
200200
201201int main () {
202202
203- HttpClient httpClient ;
203+ HttpRequest httpRequest ;
204204
205205 // If you need to retrieve binary data such as an image, just pass the "returnAsBinary" parameter as true
206- auto response = httpClient .getRequest("https://api.myproject.com/image/7", true).get();
206+ auto response = httpRequest .getRequest("https://api.myproject.com/image/7", true).get();
207207
208208 std::cout << "Succeed: " << response.succeed << std::endl;
209209 std::cout << "Http Status Code: " << response.statusCode << std::endl;
@@ -229,15 +229,15 @@ using namespace lklibs;
229229
230230int main () {
231231
232- HttpClient httpClient ;
232+ HttpRequest httpRequest ;
233233
234234 // You can send custom headers in a string/string map
235235 auto headers = std::map<std::string, std::string>();
236236
237237 headers["Custom-Header1"] = "value1";
238238 headers["Custom-Header2"] = "value2";
239239
240- auto response = httpClient .getRequest("https://api.myproject.com?param1=7¶m2=test", headers).get();
240+ auto response = httpRequest .getRequest("https://api.myproject.com?param1=7¶m2=test", headers).get();
241241
242242 std::cout << "Succeed: " << response.succeed << std::endl;
243243
@@ -259,12 +259,12 @@ using namespace lklibs;
259259
260260int main () {
261261
262- HttpClient httpClient ;
262+ HttpRequest httpRequest ;
263263
264264 // You can send a POST request with form data in the payload
265265 std::string payload = "param1=7¶m2=test";
266266
267- auto response = httpClient .postRequest("https://api.myproject.com", payload).get();
267+ auto response = httpRequest .postRequest("https://api.myproject.com", payload).get();
268268
269269 std::cout << "Succeed: " << response.succeed << std::endl;
270270 std::cout << "Http Status Code: " << response.statusCode << std::endl;
@@ -288,7 +288,7 @@ using namespace lklibs;
288288
289289int main () {
290290
291- HttpClient httpClient ;
291+ HttpRequest httpRequest ;
292292
293293 std::string payload = R"({"param1": 7, "param2": "test"})";
294294
@@ -297,7 +297,7 @@ int main() {
297297
298298 headers["Content-Type"] = "application/json";
299299
300- auto response = httpClient .postRequest("https://api.myproject.com", payload, headers).get();
300+ auto response = httpRequest .postRequest("https://api.myproject.com", payload, headers).get();
301301
302302 std::cout << "Succeed: " << response.succeed << std::endl;
303303 std::cout << "Http Status Code: " << response.statusCode << std::endl;
@@ -320,13 +320,13 @@ using namespace lklibs;
320320
321321int main () {
322322
323- HttpClient httpClient ;
323+ HttpRequest httpRequest ;
324324
325325 std::string payload = "param1=7¶m2=test";
326326
327- auto future1 = httpClient .putRequest("https://api.myproject.com", payload);
328- auto future2 = httpClient .deleteRequest("https://api.myproject.com", payload);
329- auto future3 = httpClient .patchRequest("https://api.myproject.com?param1=7¶m2=test");
327+ auto future1 = httpRequest .putRequest("https://api.myproject.com", payload);
328+ auto future2 = httpRequest .deleteRequest("https://api.myproject.com", payload);
329+ auto future3 = httpRequest .patchRequest("https://api.myproject.com?param1=7¶m2=test");
330330
331331 auto response1 = future1.get();
332332 auto response2 = future2.get();
@@ -341,7 +341,7 @@ int main() {
341341
342342If you need to ignore SSL certificate errors for any valid reason, you can continue
343343working by passing ** "true"** value to the ** "ignoreSslErrors"** variable of the
344- HttpClient class.
344+ HttpRequest class.
345345
346346``` cpp
347347#include < fstream>
@@ -351,12 +351,12 @@ using namespace lklibs;
351351
352352int main () {
353353
354- HttpClient httpClient ;
354+ HttpRequest httpRequest ;
355355
356356 // If you need to ignore SSL errors, you can set the "ignoreSslErrors" field to true
357- httpClient .ignoreSslErrors = true;
357+ httpRequest .ignoreSslErrors = true;
358358
359- auto response = httpClient .getRequest("https://api.myinvalidssl.com").get();
359+ auto response = httpRequest .getRequest("https://api.myinvalidssl.com").get();
360360
361361 return 0;
362362}
0 commit comments