onResponse method
Handles dio response and adds data to alice http call
Implementation
@override
void onResponse(
Response<dynamic> response,
ResponseInterceptorHandler handler,
) {
final httpResponse = AliceHttpResponse()..status = response.statusCode;
if (response.data == null) {
httpResponse
..body = ''
..size = 0;
} else {
httpResponse
..body = response.data
..size = utf8.encode(response.data.toString()).length;
}
httpResponse.time = DateTime.now();
final headers = <String, String>{};
response.headers.forEach((header, values) {
headers[header] = values.toString();
});
httpResponse.headers = headers;
aliceCore.addResponse(httpResponse, response.requestOptions.hashCode);
handler.next(response);
}