I am iterating over an array (using forEach
method) and calling DELETE
http method in Angular
array: ["1", "2", "3"];
url: [DELETE] http://localhost/deleteUser/{{id}}
code:
users.forEach(user => {
this.http.delete(`http://localhost/deleteUsers/${user}`).toPromise());
});
I am getting 422 unprocessable error
Error Message:
The entity "claim Primary Key> 56,156" cannot be updated because it has changed or been deleted since it was last read
. This error happens only when I do it from Angular. I tried with scripts and postman and it was working fine.
But, when I try the same from postman collection runner looping over the list, it works fine without any error.
From Angular I tried adding some delays after every request and still getting the same error. This is error occurs randomly and only for some of the requests in the array (no specific request it is just random).
Postman collection below (works fine)