
HTTP traffic inspector logging requests, responses, headers and bodies; supports mocking/overriding, HAR export, in-app UI, configurable filters, sanitization, retention and notifications.
[!CAUTION] This library is not stable, and the API may change. It is not advised to use it in production projects.
Inspektor is an HTTP inspection library for Ktor. It allows you to view HTTP requests and responses, including basic information, headers, and bodies directly on your device.
Add the following dependency to your build.gradle.kts file:
repositories {
mavenCentral()
}
dependencies {
implementation("pro.cashkeeper.inspektor:inspektor:0.1.2")
}To use Inspektor, install the plugin in your HttpClient configuration:
import pro.cashkeeper.inspektor.Inspektor
val client = HttpClient {
install(Inspektor)
}
suspend fun apiCall() {
client.get("https://example.com")
}To open the inspection UI, call the openInspektor() function from your UI (e.g., from a developer menu or a long-press gesture):
import pro.cashkeeper.inspektor.openInspektor
// Trigger this from your UI
openInspektor()Add -lsqlite3 to Other Linker Flags in your Xcode Build Settings.
Call setApplicationId before using Inspektor to define where the database should be stored:
import pro.cashkeeper.inspektor.setApplicationId
fun main() {
setApplicationId("pro.cashkeeper.sample")
// ...
}You can customize Inspektor using the InspektorConfig block:
install(Inspektor) {
level = LogLevel.BODY
maxContentLength = 250_000
showNotifications = true
retentionDuration = 30.days
// Filter specific requests
filter { request -> request.url.host.contains("api.example.com") }
// Sanitize sensitive headers
sanitizeHeader { header -> header == "Authorization" }
}This project is licensed under the MIT License. See the LICENSE file for details.
Inspired by Chucker - An HTTP inspector for Android & OkHttp.
[!CAUTION] This library is not stable, and the API may change. It is not advised to use it in production projects.
Inspektor is an HTTP inspection library for Ktor. It allows you to view HTTP requests and responses, including basic information, headers, and bodies directly on your device.
Add the following dependency to your build.gradle.kts file:
repositories {
mavenCentral()
}
dependencies {
implementation("pro.cashkeeper.inspektor:inspektor:0.1.2")
}To use Inspektor, install the plugin in your HttpClient configuration:
import pro.cashkeeper.inspektor.Inspektor
val client = HttpClient {
install(Inspektor)
}
suspend fun apiCall() {
client.get("https://example.com")
}To open the inspection UI, call the openInspektor() function from your UI (e.g., from a developer menu or a long-press gesture):
import pro.cashkeeper.inspektor.openInspektor
// Trigger this from your UI
openInspektor()Add -lsqlite3 to Other Linker Flags in your Xcode Build Settings.
Call setApplicationId before using Inspektor to define where the database should be stored:
import pro.cashkeeper.inspektor.setApplicationId
fun main() {
setApplicationId("pro.cashkeeper.sample")
// ...
}You can customize Inspektor using the InspektorConfig block:
install(Inspektor) {
level = LogLevel.BODY
maxContentLength = 250_000
showNotifications = true
retentionDuration = 30.days
// Filter specific requests
filter { request -> request.url.host.contains("api.example.com") }
// Sanitize sensitive headers
sanitizeHeader { header -> header == "Authorization" }
}This project is licensed under the MIT License. See the LICENSE file for details.
Inspired by Chucker - An HTTP inspector for Android & OkHttp.