From 47e5af15ea1445627c3b1ca6bba13855c60679ef Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 22 Nov 2020 09:22:40 -0500 Subject: [PATCH] Updated README --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84efbb2..4a59601 100644 --- a/README.md +++ b/README.md @@ -502,7 +502,7 @@ auto res = cli.Get( ```cpp std::string body = ...; -auto res = cli_.Post( +auto res = cli.Post( "/stream", body.size(), [](size_t offset, size_t length, DataSink &sink) { sink.write(body.data() + offset, length); @@ -511,6 +511,21 @@ auto res = cli_.Post( "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 ```cpp