Skip to content

Commit fc2da51

Browse files
author
Levent KARAGÖL
committed
Documentation has been updated
1 parent 6e8021e commit fc2da51

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Modern, non-blocking and exception free, header-only HTTP Client library for C++
1616

1717
* [How to add it to my project](#how-to-add-it-to-my-project)
1818
* [How to use? (Simplest way)](#how-to-use-simplest-way)
19-
* [What does exception free mean?](#what-does-exception-free-mean)
2019
* [What does non-blocking mean?](#what-does-non-blocking-mean)
20+
* [What does exception free mean?](#what-does-exception-free-mean)
2121
* [What about binary data?](#what-about-binary-data)
2222
* [Sending Custom HTTP Headers](#sending-custom-http-headers)
2323
* [POST request with form data](#post-request-with-form-data)
@@ -81,41 +81,6 @@ int main() {
8181
```
8282

8383

84-
## What does exception free mean?
85-
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.
92-
93-
You can see an example use case below...
94-
95-
```cpp
96-
#include <fstream>
97-
#include "libcpp-http-client.hpp"
98-
99-
using namespace lklibs;
100-
101-
int main() {
102-
103-
auto response = HttpClient::getRequest("https://www.myinvalidurl.com").get();
104-
105-
// Instead of throwing an exception, the succeed field of the response object is set to false
106-
std::cout << "Succeed: " << response.succeed << std::endl;
107-
108-
// And the http status code is set to the statusCode field (404 in this case)
109-
std::cout << "Http Status Code: " << response.statusCode << std::endl;
110-
111-
// Also if any error message is available, it is set to the errorMessage field
112-
std::cout << "Error Message: " << response.errorMessage << std::endl;
113-
114-
return 0;
115-
}
116-
```
117-
118-
11984
## What does non-blocking mean?
12085

12186
Let's talk about this through an example. Let's say we call 5 different API methods when our
@@ -175,6 +140,41 @@ int main() {
175140
All functions in the library return a future and allow the next line to run without blocking the flow.
176141

177142

143+
## What does exception free mean?
144+
145+
Exception Free means that no exception will be thrown for any call you make to this library.
146+
If the URL cannot be found, there is a timeout, there is an authorization problem or another
147+
error occurs on the server, the bool typed "succeed" field of the response is returned as false.
148+
In addition, the HTTP Status Code value returned from the server is returned in the int typed
149+
"statusCode" field and possibly additional error information that may be returned from the server
150+
is returned in the string typed "errorMessage" field.
151+
152+
You can see an example use case below...
153+
154+
```cpp
155+
#include <fstream>
156+
#include "libcpp-http-client.hpp"
157+
158+
using namespace lklibs;
159+
160+
int main() {
161+
162+
auto response = HttpClient::getRequest("https://www.myinvalidurl.com").get();
163+
164+
// Instead of throwing an exception, the succeed field of the response object is set to false
165+
std::cout << "Succeed: " << response.succeed << std::endl;
166+
167+
// And the http status code is set to the statusCode field (404 in this case)
168+
std::cout << "Http Status Code: " << response.statusCode << std::endl;
169+
170+
// Also if any error message is available, it is set to the errorMessage field
171+
std::cout << "Error Message: " << response.errorMessage << std::endl;
172+
173+
return 0;
174+
}
175+
```
176+
177+
178178
## What about binary data?
179179

180180
In the examples so far, we have used the **"textData"** property of the returning response object.

0 commit comments

Comments
 (0)