android-components / mozilla.components.concept.fetch.interceptor / Interceptor / intercept


abstract fun intercept(chain: Chain): Response (source)

Allows an Interceptor to intercept a request and modify request or response.

An interceptor can retrieve the request by calling Chain.request.

If the interceptor wants to continue executing the chain (which will execute potentially other interceptors and may eventually perform the request) it can call Chain.proceed and pass along the original or a modified request.

Finally the interceptor needs to return a Response. This can either be the Response from calling Chain.proceed - modified or unmodified - or a Response the interceptor created manually or obtained from a different source.