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

bsimmons

05/26/2020, 12:55 PM
Hey all, so I am attempting to make a POST request in a unit test using ktor on iOS (native) and I get this certificate error.
io.ktor.client.engine.ios.IosHttpRequestException: Exception in http request: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid..."
Any ideas on how to solve this? (this request works on every other device I've tried.)
e

e5l

05/26/2020, 1:02 PM
Hi @bsimmons, could you tell me if you're using a device or a simulator?
b

bsimmons

05/26/2020, 1:02 PM
I am using a simulator.
e

e5l

05/26/2020, 1:04 PM
Could you check that you have all root certs on the simulator? You also can set custom
handleChallenge
in the
iOS
engine config to bypass this check.
b

bsimmons

05/26/2020, 1:07 PM
I'm not entirely sure how checking the root certs works on the simulator.
r

russhwolf

05/26/2020, 3:14 PM
Possibly related: https://youtrack.jetbrains.com/issue/KT-38317 (the error is the same but the setup sounds different)
b

bsimmons

05/26/2020, 3:51 PM
@russhwolf Pure gold. That answer got things working. Thanks for the help!
👍 1
21 Views