exec method

Future<Map<String, dynamic>> exec(
  1. Request request
)

Sends the http request and returns the response as a Map

Implementation

Future<Map<String, dynamic>> exec(Request request) async {
  var response = await send(request);
  var doc_str = await response.stream.bytesToString();
  Map<String, dynamic> doc = jsonDecode(doc_str);
  if (doc['error'] != null && doc['error']) {
    var message = 'ClientException : ${doc['errorMessage']} [${doc['code']}]';
    throw ClientException(message, request.url);
    //return null;
  } else {
    return doc;
  }
}