Hi folks, i'm struggling to figure out how to test...
# ktor
t
Hi folks, i'm struggling to figure out how to test a ktor client making a post request. I have a class called MailSender which posts to a remote server. In MailSenderTest I would like to catch the underlying post request inspect it ... but I can't seem to figure out how to do this. I was looking into the MockEngine, but to get that to work MailSender needs to have access to the MockEngine which is in my testImplementation dependencies ... this should be straightforward so i'm clearly missing something ... any suggestions?
r
Adjust your
MailSender
so that you supply it a
HttpClientEngine
explicitly. Then you can pass the
MockEngine
to it in your test code.
t
Ahh yes thank you ­čÖĆ