OkHttp Interceptor
Capture HTTP/HTTPS traffic with the WormaCeptor OkHttp interceptor.
OkHttp Interceptor
Add WormaCeptorInterceptor to your OkHttp client to capture HTTP/HTTPS traffic:
val interceptor = WormaCeptorInterceptor()
.showNotification(true)
.maxContentLength(500_000L)
.retainDataFor(WormaCeptorInterceptor.Period.ONE_WEEK)
.redactHeader("Authorization")
.redactHeader("Cookie")
.redactJsonValue("password")
.redactXmlValue("apiKey")
val client = OkHttpClient.Builder()
.addInterceptor(interceptor)
.build()Builder Methods
All methods return WormaCeptorInterceptor for chaining.
| Method | Description |
|---|---|
showNotification(show: Boolean) | Enable/disable system notification on capture (default: true) |
maxContentLength(length: Long) | Max body size to capture in bytes (default: 250,000) |
retainDataFor(period: Period) | Auto-delete transactions older than the specified period |
redactHeader(name: String) | Redact a header value (case-insensitive) |
redactBody(pattern: String) | Redact body content matching a regex pattern |
redactJsonValue(key: String) | Redact JSON values by key name |
redactXmlValue(tag: String) | Redact XML element content by tag name |
Period Enum
| Value | Duration |
|---|---|
ONE_HOUR | 1 hour |
ONE_DAY | 24 hours |
ONE_WEEK | 7 days |
ONE_MONTH | 30 days |
FOREVER | No cleanup |
Rate Limiting
Both the OkHttp interceptor and Ktor plugin automatically integrate with the Rate Limiter tool. When rate limiting is enabled in the WormaCeptor UI, artificial latency is applied to network calls.