I need to cancel a httpRequest with DELETE verb before it finishes (because user has canceled the operation)
The solution I have found seems to be just canceling the subscription to the observable, but if the httpRequest was sent and process by the API is not really canceling the request, is just canceling the reaction to the request finishing - https://mcmap.net/q/234475/-how-to-cancel-a-httprequest-in-angular-2
Is there a way to cancel the actual request (not the subscription) before if finishes ?
export class MileageTrackingService extends BaseService {
public deleteByDomainId(id, domainId: string) {
const params = new HttpParams().set('domainId', domainId)
return this.httpClient.delete<any>(`API-URL/mil-track/${id}`, { params });
}
}
aborted
, meanwhile, you can send another request to set theabort
flag on the job. The process that executes your task can then periodically check that database flag to see if it should abort execution. – Fletcher