@@ -59,7 +59,7 @@ target_link_libraries(myProject PRIVATE libcpp-http-client CURL::libcurl)
5959Below you can see the simplest use case sending QueryString parameters to an API via HTTP GET.
6060
6161> [ !IMPORTANT]
62- > Please do not use it this way, if more than one call will be made . You do not use the non-blocking
62+ > Please do not use it this way, if more than one call will be made. You do not use the non-blocking
6363> feature in this way. Just keep reading...
6464
6565``` cpp
@@ -155,7 +155,7 @@ int main() {
155155}
156156```
157157
158- All functions in the library return a future and allow the next line to run without blocking the flow.
158+ ** "send" ** function in the library return a future and allow the next line to run without blocking the flow.
159159
160160
161161## What does exception free mean?
@@ -200,8 +200,7 @@ int main() {
200200In the examples so far, we have used the ** "textData"** property of the returning response object.
201201However, we need binary data for requests made to binary files such as images. In such cases,
202202we can ensure that the returned data is returned in ** "binaryData"** of type
203- *** "std::vector< ; unsigned char> ; "*** instead of ** "textData"** by passing the value ** "true"**
204- to the ** "returnAsBinary"** parameter.
203+ *** "std::vector< ; unsigned char> ; "*** instead of ** "textData"** by calling ** "returnAsBinary()"** method before send as follow.
205204
206205``` cpp
207206#include < fstream>
@@ -232,8 +231,7 @@ int main() {
232231
233232## Sending custom HTTP headers
234233
235- If you need to send custom HTTP HEADERs during the request, you can send them in
236- std::map<std::string, std::string> format.
234+ If you need to send custom HTTP HEADERs during the request, you can add them to the request as key-value pairs with ** "addHeader()"** method.
237235
238236``` cpp
239237#include < fstream>
@@ -243,7 +241,7 @@ using namespace lklibs;
243241
244242int main () {
245243
246- HttpRequest httpRequest("https://api.myproject.com?param1=7¶m2=test ");
244+ HttpRequest httpRequest("https://api.myproject.com");
247245
248246 // You can send custom headers as key-value pairs
249247 auto response = httpRequest
@@ -261,8 +259,7 @@ int main() {
261259
262260## POST request with form data
263261
264- Next is submitting form data via HTTP POST. All you have to do is use ** "postRequest"** instead
265- of ** "getRequest"** . You can pass the form data to the ** "payload"** variable as seen in the sample code below.
262+ Next is submitting form data via HTTP POST. All you have to do is use ** "setMethod"** to change HTTP method type. You can pass the form data with ** "setPaylod"** method as seen in the sample code below.
266263
267264``` cpp
268265#include < fstream>
@@ -339,24 +336,21 @@ int main() {
339336 auto future1 = httpRequest
340337 .setMethod(HttpMethod::PUT)
341338 .setPayload("param1=7¶m2=test")
342- .send()
343- .get();
339+ .send();
344340
345341 HttpRequest httpRequest2("https://api.myproject.com");
346342
347343 auto future2 = httpRequest
348344 .setMethod(HttpMethod::DELETE_)
349345 .setPayload("param1=7¶m2=test")
350- .send()
351- .get();
346+ .send();
352347
353348 HttpRequest httpRequest3("https://api.myproject.com");
354349
355350 auto future3 = httpRequest
356351 .setMethod(HttpMethod::PATCH)
357352 .setQueryString("param1=7¶m2=test")
358- .send()
359- .get();
353+ .send();
360354
361355 auto response1 = future1.get();
362356 auto response2 = future2.get();
@@ -369,9 +363,8 @@ int main() {
369363
370364## How to ignore SSL certificate errors?
371365
372- If you need to ignore SSL certificate errors for any valid reason, you can continue
373- working by passing ** "true"** value to the ** "ignoreSslErrors"** variable of the
374- HttpRequest class.
366+ If you need to ignore SSL certificate errors for any valid reason, you can call "ignoreSslErrors"
367+ method before sending the request.
375368
376369``` cpp
377370#include < fstream>
@@ -384,7 +377,10 @@ int main() {
384377 HttpRequest httpRequest("https://api.myinvalidssl.com");
385378
386379 // If you need to ignore SSL errors, you can call "ignoreSslErrors" method before sending the request
387- auto response = httpRequest.ignoreSslErrors().send().get();
380+ auto response = httpRequest
381+ .ignoreSslErrors()
382+ .send()
383+ .get();
388384
389385 return 0;
390386}
@@ -410,7 +406,7 @@ section to the documentation.
410406## Full function list
411407
412408You can find the complete list of functions in the library below. Since all methods except
413- send return the class itself, they can be added one after the other like a chain.
409+ send return the class itself, so they can be added one after the other like a chain.
414410
415411> [ !TIP]
416412> All methods and parameters descriptions are also available within the code as comment for IDEs.
0 commit comments