delete method

Future<Response> delete(
  1. String path
)

Implementation

Future<http.Response> delete(String path) async {
  DRFAuth auth = DRFAuth(cleanBaseUrl(baseUrl), usernameField, cleanPath(tokenPath), cleanPath(refreshPath));
  final token = await auth.getTokenWithRefresh();
  if (token == null) {
    throw Exception("User is not logged in or token refresh failed.");
  }

  final headers = {
    'Authorization': 'Bearer $token',
    'Accept': 'application/json',
    'Content-Type': 'application/json',
  };

  final response = await http.delete(
    Uri.parse('${cleanBaseUrl(baseUrl)}${cleanPath(path)}'),
    headers: headers,
  );

  return response;
}