onResponse method
Called when the response is about to be resolved.
Implementation
@override
Future<void> onResponse(
Response response,
ResponseInterceptorHandler handler,
) async {
if (_etagStorageReady &&
response.requestOptions.method == 'GET' &&
response.requestOptions.extra['disableCache'] != true &&
response.extra['isMocked'] != true) {
// Store new ETag on successful 200
final etag = response.headers.value('etag');
if (etag != null && response.statusCode == 200) {
final key = LikeSessionIdentity.forRequest(response.requestOptions);
try {
await LikeService.putEtag(key, etag);
} catch (_) {}
}
}
handler.next(response);
}