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

Nish Patel

11/25/2020, 6:21 AM
Hi guys, how would we use mockengine for mocking the response from an endpoint, if some one could give an example or some kind of explanation would be good
c

christophsturm

11/25/2020, 1:05 PM
first create a mock client with something like this
Copy code
val client = run {
        HttpClient(MockEngine) {
            engine {
                addHandler { r ->
and then you inject it into your classes and they use it to make the http request
👍 1
2 Views