WormaCeptor

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.

MethodDescription
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

ValueDuration
ONE_HOUR1 hour
ONE_DAY24 hours
ONE_WEEK7 days
ONE_MONTH30 days
FOREVERNo 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.

On this page