get method

Future<Response> get({
  1. String path = '',
  2. Map<String, String>? headers,
  3. Map<String, dynamic>? params,
})

Utility method to make a custom http get call with the Api Key added to the headers

Implementation

Future<Response> get({
  String path = '',
  Map<String, String>? headers,
  Map<String, dynamic>? params,
}) async {
  // return await call('get', path: path, headers: headers, params: params);
  headers ??= {};
  headers.addAll({
    'content-type': 'application/json',
    'X-APIKEY': apiKey,
  });

  try {
    final finalUri = _getUriUrl(basePath + path, params);
    return await _client.get(finalUri, headers: headers);
  } catch (e) {
    if (e is HolodexException) {
      rethrow;
    }
    throw HolodexException(e.toString());
  }
}