Skip to content

OkHttp

To use Harbringer with OkHttp, you need to add the harbringer-okhttp3 dependency to your project. Then you can add it to your OkHttp builder:

val harbringer = Harbringer(
    storage = FileSystemHarbringerStorage(storageDirectory.toPath()),
    maxRequests = 1000, // 1000 requests
    maxDiskSize = 100 * 1024 * 1024, // 100MB
    maxAge = 2.days,
)

val okHttpClient = OkHttpClient.Builder()
    .addHarbringer(harbringer)
    .build()