mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-04 04:54:49 +00:00
Implement streamed body reading in httpclient.
This commit is contained in:
@@ -13,7 +13,9 @@ proc asyncTest() {.async.} =
|
||||
var client = newAsyncHttpClient()
|
||||
var resp = await client.request("http://example.com/")
|
||||
doAssert(resp.code.is2xx)
|
||||
doAssert("<title>Example Domain</title>" in resp.body)
|
||||
var body = await resp.body
|
||||
body = await resp.body # Test caching
|
||||
doAssert("<title>Example Domain</title>" in body)
|
||||
|
||||
resp = await client.request("http://example.com/404")
|
||||
doAssert(resp.code.is4xx)
|
||||
|
||||
Reference in New Issue
Block a user