delete<_Model extends RestModel> method
Future<Response?>
delete<_Model extends RestModel>(
- _Model instance, {
- Query? query,
- ModelRepository<
RestModel> ? repository,
Sends a DELETE request method to the endpoint
Implementation
@override
Future<http.Response?> delete<_Model extends RestModel>(instance, {query, repository}) async {
final url = urlForModel<_Model>(query, instance);
if (url == null) return null;
logger.fine('DELETE $url');
final resp = await client.delete(Uri.parse(url), headers: headersForQuery(query));
logger.finest('#delete: url=$url statusCode=${resp.statusCode} body=${resp.body}');
if (statusCodeIsSuccessful(resp.statusCode)) {
return resp;
} else {
logger.warning('#delete: url=$url statusCode=${resp.statusCode} body=${resp.body}');
throw RestException(resp);
}
}