FlipMock is a extended Flipper plugin that manipulates network response.
- Support OkHttp
- Mock the response by HTTP method.
- Mock the response by query parameters.
- For response, support HTTP code
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.enciyo:FlipMock:$version'
}
class FlipperApp : Application() {
companion object {
val flipMockPlugin = FlipMockPlugin.getInstance()
}
override fun onCreate() {
super.onCreate()
val client = AndroidFlipperClient.getInstance(this)
///....
client.addPlugin(flipMockPlugin)
///...
client.start()
}
}
fun provideOkHttpClient(): OkHttpClient {
val okhttp = OkHttpClient.Builder()
if (BuildConfig.DEBUG){
okhttp.addInterceptor(FlipperApp.flipMockPlugin.interceptor)
}
return okhttp.build()
}
In this section, you can mock response using FlipMock desktop Plugin on the Flipper.