Skip to content

Commit 6d6a380

Browse files
committed
Documentation has been updated for setTimeout method
1 parent 0072be7 commit 6d6a380

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Modern, non-blocking and exception free, header-only HTTP Client library for C++
2424
* [POST request with JSON data](#post-request-with-json-data)
2525
* [What about others? (PUT, DELETE, PATCH)](#what-about-others-put-delete-patch)
2626
* [How to ignore SSL certificate errors?](#how-to-ignore-ssl-certificate-errors)
27+
* [How to set timeout?](#how-to-set-timeout)
2728
* [How can I limit download and upload bandwidth?](#how-can-i-limit-download-and-upload-bandwidth)
2829
* [Semantic Versioning](#semantic-versioning)
2930
* [Full function list](#full-function-list)
@@ -387,6 +388,29 @@ int main() {
387388
}
388389
```
389390

391+
## How to set timeout?
392+
393+
You can use the setTimeout method to set the timeout duration in seconds during requests.
394+
395+
```cpp
396+
#include <fstream>
397+
#include "libcpp-http-client.hpp"
398+
399+
using namespace lklibs;
400+
401+
int main() {
402+
HttpRequest httpRequest("https://api.myproject.com");
403+
404+
// You can set the timeout in seconds
405+
auto response = httpRequest
406+
.setTimeout(3) // 3 sec
407+
.send()
408+
.get();
409+
410+
return 0;
411+
}
412+
```
413+
390414

391415
## How can I limit download and upload bandwidth?
392416

0 commit comments

Comments
 (0)