Created
June 15, 2023 22:34
-
-
Save tugceaktepe/38ac1698aac4503edd2d3601e7050e63 to your computer and use it in GitHub Desktop.
throttleBody example
This file contains hidden or 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
internal inner class RequestDispatcher : Dispatcher() { | |
override fun dispatch(request: RecordedRequest): MockResponse { | |
return when (request.path) { | |
"/movie/top_rated?api_key=${API_KEY}&language=en-US&page=1" -> | |
MockResponse().setResponseCode(200) | |
.setBody(FileReader.readStringFromFile("success_response.json")) | |
.throttleBody(1024, 200L, TimeUnit.MILLISECONDS) | |
else -> MockResponse().setResponseCode(400) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment