Skip to content

Commit ba2825b

Browse files
author
Levent KARAGÖL
committed
Documentation has been updated for setDownloadBandwidthLimit and setUploadBandwidthLimit methods
1 parent 32f2cfa commit ba2825b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 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 can I limit download and upload bandwidth?](#how-can-i-limit-download-and-upload-bandwidth)
2728
* [Semantic Versioning](#semantic-versioning)
2829
* [Full function list](#full-function-list)
2930
* [License](#license)
@@ -387,6 +388,31 @@ int main() {
387388
```
388389

389390

391+
## How can I limit download and upload bandwidth?
392+
393+
If you do not want the bandwidth to exceed a certain limit during the download and upload process, you can determine the maximum limit that can be used in Bytes with the setDownloadBandwidthLimit and setUploadBandwidthLimit methods.
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 download and upload bandwidth limit in bytes per second
405+
auto response = httpRequest
406+
.setDownloadBandwidthLimit(10240) // 10 KB/sec
407+
.setUploadBandwidthLimit(20480) // 20 KB/sec
408+
.send()
409+
.get();
410+
411+
return 0;
412+
}
413+
```
414+
415+
390416
## Semantic Versioning
391417

392418
Versioning of the library is done using conventional semantic versioning. Accordingly,

0 commit comments

Comments
 (0)