Hey friends! :slightly_smiling_face: I have a ques...
# ktor
p
Hey friends! 🙂 I have a question regarding
HttpClient
usage. If I want to execute an API call when someone “hits” a specific endpoint, do I just need to call
<http://client.post|client.post>(…)
inside the route callback, or am I missing something? It is like the call is never executed and cancelled after the specified timeout..! Thanks in advance!
e
Hi @pavlospt,
<http://client.post|client.post>(...)
should be enough. To clarify where it stucks you can enable
Logging
feature
p
Hey @e5l, how do I do that for HttpClients? I am not sure if I missed it in the documentation 😕
p
Yes totally missed it. Thank you!
👍 1
Do I need to create a new HttpClient for each API call I want to execute?
Seems like the call is starting but never finishes
e
nope
p
Then the usage of
.use
is still valid if I want to use the same client?
e
Could you provide the example?
p
Give me a minute to move that to a Gist!
Also from what I see in the logs, the API request seems to be initiating, but never completing!
🤔 1
e
Sorry, I can’t reproduce it. Could you replace the client endpoint with your own server?
p
the client endpoint is responding properly, because I also have another CLI app that is using the same client endpoint
Apparently it has something to do with the platform that I am hosting the application. It seems that it can complete without timing out in like 1/5 tries! Thank you for your help & time 😄
😉 1