Is there a way to connect client & server test...
# ktor
m
Is there a way to connect client & server test engines? So that a Ktor client with test engine executes its request on a Ktor server with test engine.
e
Yep, there is
TestApplicationEngine
and it works with client as well
m
How do I connect the two? So that
HttpClient
uses the
TestApplicationEngine
to run requests in the server pipeline.
e
TestApplicationEngine
class has
client
field
so when you use this client instance, engine will get all requests
withApplication
creates test server with test engine, and the
client
is used in 54 line to make the request
All requires stuff is available in
ktor-server-test-host
module
m
Ah,
TestHttpClientEngine
. I need an engine factory. That will do, thank you 🙏