Let’s say that while the API doing the work on backend, the http request consumer got disconnected. Therefore, database is updated but the consumer application doesn’t know about it.
Is this scenario possible?
How can such a case be tested?
Let’s say that while the API doing the work on backend, the http request consumer got disconnected. Therefore, database is updated but the consumer application doesn’t know about it.
Is this scenario possible?
How can such a case be tested?
2
Answers
I think it is certainly a possibility.
The first thing I would try is to make the client-expected response from the API nothing in order to simulate such a scenario.
Yes, it’s possible and common, your client need consider this situation. Also that’s one of the reasons to use RESTful API, because it is stateless.
There’s several ways to simulate such a scenario, one of them could be to put a sleep timer on your backend method so you manually disconnect or close the client, or it may reach timeout as well.