ResponseInterceptor typedef
ResponseInterceptor =
FutureOr<Response> Function(Response response)
Interceptor callback that transforms or inspects an incoming http.Response before returning to callers.
Can inspect status codes, refresh expired authentication tokens, log response times, or rewrite bodies. Multiple interceptors execute sequentially in the order registered in BloomHttpClient.responseInterceptors.
client.responseInterceptors.add((response) async {
if (response.statusCode == 401) {
// Handle token expiration or refresh
}
return response;
});
Implementation
typedef ResponseInterceptor = FutureOr<http.Response> Function(
http.Response response);