https://kotlinlang.org logo
#ktor
Title
# ktor
p

Pim

03/29/2024, 3:17 PM
Hey everyone, I have a question about unit testing ktor-server and HTTPS. I read https://ktor.io/docs/testing.html#https, which makes it seem possible to test HTTPS in unit tests. Is this performing an actual HTTPS request, including the whole TLS handshake? I thought that unit testing with
testApplication
does not perform real HTTP(S) requests. Does this mean I should use end-to-end tests; such as: https://ktor.io/docs/testing.html#end-to-end What I try to achieve is make sure that my HTTPS request handling works, and that my
sslConnector
is setup correctly. Thanks in advance!
a

Aleksei Tirman [JB]

03/29/2024, 3:47 PM
Is this performing an actual HTTPS request, including the whole TLS handshake?
No. The
testApplication
doesn't use the real network. So yes, you can verify the secure connection by writing the end-to-end tests.
👍 1
p

Pim

03/29/2024, 4:23 PM
Great thanks a lot for your reply! 🙌