Gus
09/08/2020, 4:33 PMMockEngine
for testing. However, I'm finding myself duplicating the config (e.g., install(...)
) across the two clients because I couldn't find a way to define it once. Any pointers on how one may do that?val mockClient = HttpClient(MockEngine) {
engine {
addHandler(...)
}
install(originalClient)
}
Chris Fillmore
09/08/2020, 6:13 PMGus
09/08/2020, 6:41 PMMockEngine
so I wouldn't like to rewrite it to use MockWebServer from OkHTTP.
Anyway, I've manage to achieve what I wanted by making the engine in HttpClient(...)
variable (OkHTTP in prod, MockEngine in the unit tests).