I am trying to execute the example of async-http-client
doku. But unfortunately the code in the closure is not executed. Why?
import AsyncHTTPClient
let httpClient = HTTPClient(eventLoopGroupProvider: .createNew)
httpClient.get(url: "https://swift.org").whenComplete { result in
print (result)
switch result {
case .failure(let error):
print("failure")
case .success(let response):
if response.status == .ok {
print("success")
} else {
print("error in response")
}
}
}
In the console I get: Program ended with exit code: 0
. So it is executed with success. But there is no print statement in the console.
Thanks!