sendRequest method

Future<HttpBasedResponse> sendRequest (
  1. HttpBasedRequest req,
  2. String endpoint
)

Implementation

Future<HttpBasedResponse> sendRequest(
    HttpBasedRequest req, String endpoint) async {
  List<int> buffer = req.writeToBuffer();
  logTrace('Proto request converted to bytes buffer. Send to ${endpoint}.');
  http.Response res =
      await http.post(endpoint, body: {'proto': buffer.toString()});
  logTrace('Server response received.');
  HttpBasedResponse response = parseHttpBasedResponse(res.body);
  logTrace('Server response parsed.');
  return response;
}