Nim Compiler Version 0.19.0 [Windows: amd64]
Consider this code:
import asyncdispatch, httpclient
var client = newAsyncHttpClient()
var fut1 = client.getContent("https://www.google.com")
echo waitFor fut1
var fut2 = client.getContent("https://www.google.com")
echo waitFor fut2
It's works, however:
import asyncdispatch, httpclient
var client = newAsyncHttpClient()
var fut1 = client.getContent("https://www.google.com")
var fut2 = client.getContent("https://www.google.com")
echo waitFor fut1
echo waitFor fut2
It cannot get the result, why?The program certainly shouldn't hang so this is a bug (please report it on GitHub).
Why it doesn't work is because you're creating a second request before the first had a chance to complete. The HttpClient doesn't handle this case.