🎈 Hi-Jack-Mocker is a project that leverages OkHttp3's interceptor to intercept and modify network requests and responses, allowing you to verify the UI easily.
Request | Response |
---|---|
![]() |
![]() |
To integrate Hi-Jack-Mocker into your Android project, follow these steps:
You can add the project dependency using the following code:
debugImplementation("io.github.koreatlwls:hjm:0.1.0")
Note: This dependency must be added with debugImplementation and should not be included in the release environment.
override fun onCreate() {
super.onCreate()
HiJackMocker.initialize(this)
}
Add the above code in the onCreate method of your Application class.
When creating your OkHttpClient instance, include the addHiJackMocker() method:
@Provides
@Singleton
fun provideHttpClient(): OkHttpClient =
OkHttpClient.Builder()
.readTimeout(TEN_SECONDS, TimeUnit.SECONDS)
.connectTimeout(TEN_SECONDS, TimeUnit.SECONDS)
.writeTimeout(TEN_SECONDS, TimeUnit.SECONDS)
.addHiJackMocker()
.addInterceptor(getLoggingInterceptor())
.build()
To enable or disable the Hi-Jack-Mocker mode, use the ImageButton provided at the top of every activity.
This allows you to control whether the hjm mode is active.
Mode Off | Mode On |
---|---|
![]() |
![]() |
Copyright 2024 koreatlwls
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.