mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Updated README
This commit is contained in:
parent
a5c239c174
commit
47e5af15ea
17
README.md
17
README.md
@ -502,7 +502,7 @@ auto res = cli.Get(
|
|||||||
```cpp
|
```cpp
|
||||||
std::string body = ...;
|
std::string body = ...;
|
||||||
|
|
||||||
auto res = cli_.Post(
|
auto res = cli.Post(
|
||||||
"/stream", body.size(),
|
"/stream", body.size(),
|
||||||
[](size_t offset, size_t length, DataSink &sink) {
|
[](size_t offset, size_t length, DataSink &sink) {
|
||||||
sink.write(body.data() + offset, length);
|
sink.write(body.data() + offset, length);
|
||||||
@ -511,6 +511,21 @@ auto res = cli_.Post(
|
|||||||
"text/plain");
|
"text/plain");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Chunked transfer encoding
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
auto res = cli.Post(
|
||||||
|
"/stream",
|
||||||
|
[](size_t offset, DataSink &sink) {
|
||||||
|
sink.os << "chunked data 1";
|
||||||
|
sink.os << "chunked data 2";
|
||||||
|
sink.os << "chunked data 3";
|
||||||
|
sink.done();
|
||||||
|
return true; // return 'false' if you want to cancel the request.
|
||||||
|
},
|
||||||
|
"text/plain");
|
||||||
|
```
|
||||||
|
|
||||||
### With Progress Callback
|
### With Progress Callback
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user