onResponse method
Handles httpClientRequest and adds response to http alice call
Implementation
void onResponse(HttpClientResponse response, HttpClientRequest request,
{dynamic body}) async {
AliceHttpResponse httpResponse = AliceHttpResponse();
httpResponse.status = response.statusCode;
if (body != null) {
httpResponse.body = body;
httpResponse.size = utf8.encode(body.toString()).length;
} else {
httpResponse.body = "";
httpResponse.size = 0;
}
httpResponse.time = DateTime.now();
Map<String, String> headers = Map();
response.headers.forEach((header, values) {
headers[header] = values.toString();
});
httpResponse.headers = headers;
aliceCore.addResponse(httpResponse, request.hashCode);
}