Created
August 10, 2023 21:15
-
-
Save arildojr7/1e2df530999d11d3b795f22329dde00d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IrisMockInterceptor | |
class MyInterceptor : Interceptor { | |
override fun intercept(chain: Interceptor.Chain) = irisMockScope(chain) { | |
onGet(contains = "user/profile") mockResponse userProfileJson | |
onPost(endsWith = "/login") then { | |
delay(2_000) // simulating a slow response | |
if (requestContains("validPassword")) mockResponse(successLoginJson) | |
else mockResponse(errorPasswordJson) | |
} | |
enableLogs() // you can also log the calls | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment