Created
January 24, 2021 20:49
-
-
Save canergulgec/ec19eaace43d5351f64d34f02be2311d 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
fun dispatcherWithCustomBody() = object : Dispatcher() { | |
override fun dispatch(request: RecordedRequest): MockResponse { | |
with(request.path) { | |
val response = MockResponse().setResponseCode(200) | |
return when { | |
this?.contains("/images") == true -> response | |
.setBody(FileReader.readTestResourceFile("movie_images_response.json")) | |
else -> response | |
.setBody(FileReader.readTestResourceFile("success_response.json")) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment