delete method
Make DELETE request
Implementation
Future<http.Response> delete(
String endpoint, {
Map<String, String>? headers,
}) async {
try {
final uri = Uri.parse('${_config.baseUrl}$endpoint');
if (_config.enableLogging) {
debugPrint('[ApexKYC] DELETE $uri');
}
final response = await _client
.delete(uri, headers: _getHeaders(additionalHeaders: headers))
.timeout(Duration(seconds: _config.timeoutSeconds));
if (_config.enableLogging) {
debugPrint(
'[ApexKYC] Response: ${response.statusCode} ${response.body}',
);
}
return _handleResponse(response);
} catch (e) {
if (e is ApexKycException) {
rethrow;
}
throw ApexKycException(
'Unexpected error: ${e.toString()}',
originalError: e,
);
}
}