diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/httpclient.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index 4404a9426..bfeb9a52e 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -50,6 +50,20 @@ ## ## echo client.postContent("http://validator.w3.org/check", multipart=data) ## +## You can also make post requests with custom headers. +## This example sets ``Content-Type`` to ``application/json`` +## and uses a json object for the body +## +## .. code-block:: Nim +## import httpclient, json +## +## let client = newHttpClient() +## client.headers = newHttpHeaders({ "Content-Type": "application/json" }) +## let body = %*{ +## "data": "some text" +## } +## echo client.request("http://some.api", httpMethod = HttpPost, body = $body) +## ## Progress reporting ## ================== ## |