Implements getContent and postContent for (Async)HttpClient.
This commit is contained in:
parent
fa9ec7a6b5
commit
0baef8e6ea
2 changed files with 55 additions and 1 deletions
|
|
@ -21,6 +21,16 @@ proc asyncTest() {.async.} =
|
|||
resp = await client.request("https://google.com/")
|
||||
doAssert(resp.code.is2xx or resp.code.is3xx)
|
||||
|
||||
# getContent
|
||||
try:
|
||||
discard await client.getContent("https://google.com/404")
|
||||
doAssert(false, "HttpRequestError should have been raised")
|
||||
except HttpRequestError:
|
||||
discard
|
||||
except:
|
||||
doAssert(false, "HttpRequestError should have been raised")
|
||||
|
||||
|
||||
# Multipart test.
|
||||
var data = newMultipartData()
|
||||
data["output"] = "soap12"
|
||||
|
|
@ -50,6 +60,15 @@ proc syncTest() =
|
|||
resp = client.request("https://google.com/")
|
||||
doAssert(resp.code.is2xx or resp.code.is3xx)
|
||||
|
||||
# getContent
|
||||
try:
|
||||
discard client.getContent("https://google.com/404")
|
||||
doAssert(false, "HttpRequestError should have been raised")
|
||||
except HttpRequestError:
|
||||
discard
|
||||
except:
|
||||
doAssert(false, "HttpRequestError should have been raised")
|
||||
|
||||
# Multipart test.
|
||||
var data = newMultipartData()
|
||||
data["output"] = "soap12"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue