CDNImageInterceptor

class CDNImageInterceptor(cdn: () -> CDN? = { if (ChatClient.isInitialized) ChatClient.instance().cdn else null }) : Interceptor

A Coil Interceptor that intercepts image requests and applies CDN transformations.

The interceptor calls CDN.imageRequest to obtain a potentially modified URL and additional headers. CDN headers take precedence over any headers already present on the request (e.g. from io.getstream.chat.android.ui.common.helper.ImageHeadersProvider), overriding them for the same key.

Only HTTP/HTTPS URLs are intercepted; local resources, content URIs, etc. pass through unchanged.

The CDN instance is resolved lazily via cdn on each request, so the interceptor is safe to install even before ChatClient is initialized (e.g. Compose previews, VRT tests). When cdn returns null the request passes through unchanged.

Constructors

Link copied to clipboard
constructor(cdn: () -> CDN? = { if (ChatClient.isInitialized) ChatClient.instance().cdn else null })

Functions

Link copied to clipboard
open suspend override fun intercept(chain: Interceptor.Chain): ImageResult