Skip to content

Commit 37a1ebb

Browse files
author
Levent KARAGÖL
committed
Documentation has been updated
1 parent 47bdffd commit 37a1ebb

File tree

1 file changed

+49
-15
lines changed

1 file changed

+49
-15
lines changed

README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Modern, non-blocking and exception free, header-only HTTP Client library for C++
77

88

99
> [!NOTE]
10-
> Please read this document before using the library. I know, you don't have time but reading this document will save you time. I mean just this file, it's not long at all. Trial and error will cost you more time.
10+
> Please read this document before using the library. I know, you don't have time but reading
11+
> this document will save you time. I mean just this file, it's not long at all. Trial and error
12+
> will cost you more time.
1113
1214

1315
# Table of Contents
@@ -29,9 +31,11 @@ Modern, non-blocking and exception free, header-only HTTP Client library for C++
2931

3032
## How to add it to my project?
3133

32-
This is a header only library. So actually, all you need is to add the libcpp-http-client.hpp file in src folder to your project and start using it with #include.
34+
This is a header only library. So actually, all you need is to add the libcpp-http-client.hpp file
35+
in src folder to your project and start using it with #include.
3336

34-
But this library is a kind of Curl wrapper that uses Curl under the hood. So, you need to add Curl to your project before to use it.
37+
But this library is a kind of Curl wrapper that uses Curl under the hood. So, you need to add Curl to
38+
your project before to use it.
3539

3640
You can find usage examples in the examples folder, also find a sample CMakeLists.txt file content below.
3741

@@ -54,7 +58,8 @@ target_link_libraries(myProject PRIVATE libcpp-http-client CURL::libcurl)
5458
Below you can see the simplest use case sending QueryString parameters to an API via HTTP GET.
5559

5660
> [!TIP]
57-
> Please do not use it this way, if more than one call will be made . You do not use the non-blocking feature in this way.
61+
> Please do not use it this way, if more than one call will be made . You do not use the non-blocking
62+
> feature in this way.
5863
5964
```cpp
6065
#include <fstream>
@@ -78,7 +83,12 @@ int main() {
7883

7984
## What does exception free mean?
8085

81-
Exception Free means that no exception will be thrown for any call you make to this library. If the URL cannot be found, there is a timeout, there is an authorization problem or another error occurs on the server, the bool typed "succeed" field of the response is returned as false. In addition, the HTTP Status Code value returned from the server is returned in the int typed "statusCode" field and possibly additional error information that may be returned from the server is returned in the string typed "errorMessage" field.
86+
Exception Free means that no exception will be thrown for any call you make to this library.
87+
If the URL cannot be found, there is a timeout, there is an authorization problem or another
88+
error occurs on the server, the bool typed "succeed" field of the response is returned as false.
89+
In addition, the HTTP Status Code value returned from the server is returned in the int typed
90+
"statusCode" field and possibly additional error information that may be returned from the server
91+
is returned in the string typed "errorMessage" field.
8292

8393
You can see an example use case below...
8494

@@ -108,7 +118,9 @@ int main() {
108118

109119
## What does non-blocking mean?
110120

111-
Let's talk about this through an example. Let's say we call 5 different API methods when our screen opens and each one takes an average of 500 ms. If we call these methods one after another as follows, we will get all the answers in 2.5 seconds in total.
121+
Let's talk about this through an example. Let's say we call 5 different API methods when our
122+
screen opens and each one takes an average of 500 ms. If we call these methods one after another
123+
as follows, we will get all the answers in 2.5 seconds in total.
112124

113125
```cpp
114126
#include <fstream>
@@ -130,7 +142,9 @@ int main() {
130142
}
131143
```
132144

133-
".get()" call at the end of each line causes us to wait until the server responds. However, if we make the same call as follows, all requests will be processed in parallel and the total time will take approximately 0.5 seconds.
145+
".get()" call at the end of each line causes us to wait until the server responds. However,
146+
if we make the same call as follows, all requests will be processed in parallel and the total
147+
time will take approximately 0.5 seconds.
134148

135149
```cpp
136150
#include <fstream>
@@ -163,7 +177,11 @@ All functions in the library return a future and allow the next line to run with
163177

164178
## What about binary data?
165179

166-
In the examples so far, we have used the **"textData"** property of the returning response object. However, we need binary data for requests made to binary files such as images. In such cases, we can ensure that the returned data is returned in **"binaryData"** of type ***"std::vector&lt;unsigned char&gt;"*** instead of **"textData"** by passing the value **"true"** to the **"returnAsBinary"** parameter.
180+
In the examples so far, we have used the **"textData"** property of the returning response object.
181+
However, we need binary data for requests made to binary files such as images. In such cases,
182+
we can ensure that the returned data is returned in **"binaryData"** of type
183+
***"std::vector&lt;unsigned char&gt;"*** instead of **"textData"** by passing the value **"true"**
184+
to the **"returnAsBinary"** parameter.
167185

168186
```cpp
169187
#include <fstream>
@@ -189,7 +207,8 @@ int main() {
189207

190208
## Sending custom HTTP headers
191209

192-
If you need to send custom HTTP HEADERs during the request, you can send them in std::map<std::string, std::string> format.
210+
If you need to send custom HTTP HEADERs during the request, you can send them in
211+
std::map<std::string, std::string> format.
193212

194213
```cpp
195214
#include <fstream>
@@ -216,7 +235,8 @@ int main() {
216235

217236
## POST request with form data
218237

219-
Next is submitting form data via HTTP POST. All you have to do is use **"postRequest"** instead of **"getRequest"**. You can pass the form data to the **"payload"** variable as seen in the sample code below.
238+
Next is submitting form data via HTTP POST. All you have to do is use **"postRequest"** instead
239+
of **"getRequest"**. You can pass the form data to the **"payload"** variable as seen in the sample code below.
220240

221241
```cpp
222242
#include <fstream>
@@ -242,7 +262,8 @@ int main() {
242262

243263
## POST request with JSON data
244264

245-
Sending JSON data via HTTP POST is not much different. Just remember to send **"Content-Type"** as **"application/json"** via HTTP HEADER.
265+
Sending JSON data via HTTP POST is not much different. Just remember to send **"Content-Type"**
266+
as **"application/json"** via HTTP HEADER.
246267

247268
```cpp
248269
#include <fstream>
@@ -299,18 +320,24 @@ int main() {
299320

300321
## Semantic Versioning
301322

302-
Versioning of the library is done using conventional semantic versioning. Accordingly, in the versioning made as **MAJOR.MINOR.PATCH**;
323+
Versioning of the library is done using conventional semantic versioning. Accordingly,
324+
in the versioning made as **MAJOR.MINOR.PATCH**;
303325

304326
**PATCH:** Includes possible Bug&Fixes and improvements. You definitely want to get this.
305327

306-
**MINOR:** Additional functionality added via backwards compatibility. You probably want to get this, it doesn't hurt.
328+
**MINOR:** Additional functionality added via backwards compatibility. You probably want to
329+
get this, it doesn't hurt.
307330

308-
**MAJOR:** Additional functionality that breaks backwards compatibility. You'll need to know what's changed before you get it, and you'll probably have to make changes to your own code. If I publish something like this, I will definitely add the changes required for migration section to the documentation.
331+
**MAJOR:** Additional functionality that breaks backwards compatibility. You'll need to know
332+
what's changed before you get it, and you'll probably have to make changes to your own code.
333+
If I publish something like this, I will definitely add the changes required for migration
334+
section to the documentation.
309335

310336

311337
## Full function list
312338

313-
You can find the complete list of functions in the library below. In fact, they are just overloaded versions of 5 functions in total.
339+
You can find the complete list of functions in the library below. In fact, they are just
340+
overloaded versions of 5 functions in total.
314341

315342
> [!TIP]
316343
> All methods and parameters descriptions are also available within the code as comment for IDEs.
@@ -390,3 +417,10 @@ SOFTWARE.
390417
391418
392419
## Contact
420+
421+
If you have problems regarding the library, please open an
422+
[issue on GitHub](https://github.com/lk-libs/libcpp-http-client/issues/new).
423+
Please describe your request, issue, or question in as much detail as possible
424+
and also include the version of your compiler and operating system, as well as
425+
the version of the library you are using. Before opening a new issue, please
426+
confirm that the topic is not already exists in closed issues.

0 commit comments

Comments
 (0)