Skip to content

Commit d8c8bd9

Browse files
committed
Added client body reader example back in.
1 parent 672f6d3 commit d8c8bd9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ This is a convenience function allowing one to more easily use the generic inter
272272

273273
`syntax: reader, err = httpc:get_client_body_reader()`
274274

275-
Returns an iterator function which can be used to read the downstream client request body in a streaming fashion. This iterator can also be used as the value for the body field in request params, allowing one to stream the request body into a proxied upstream request.
275+
Returns an iterator function which can be used to read the downstream client request body in a streaming fashion. For example:
276276

277277
```lua
278278
local req_reader = httpc:get_client_body_reader()
@@ -290,6 +290,17 @@ repeat
290290
until not chunk
291291
```
292292

293+
This iterator can also be used as the value for the body field in request params, allowing one to stream the request body into a proxied upstream request.
294+
295+
```lua
296+
local client_body_reader, err = httpc:get_client_body_reader()
297+
298+
local res, err = httpc:request{
299+
path = "/helloworld",
300+
body = client_body_reader,
301+
}
302+
```
303+
293304
# Author
294305

295306
James Hurst <james@pintsized.co.uk>

0 commit comments

Comments
 (0)