December 2019
Intermediate to advanced
510 pages
11h 33m
English
Now that we have a controller that is able to handle our requests, we should focus on the response part. Looking at the OrderController from the response point of view, we may notice that it is not compliant with REST specifications. None of the action methods considers any failure states. What should happen if our data source is down? What should happen if the requested order is not present in our repository?
Let's start by checking what happens when we ask for an order that doesn't exist. To proceed with this check, all we need to do is make a curl request with a GUID that doesn't exist:
curl -X GET https://localhost:5001/api/order/a54f58bc-216d-4a40-8040-bafaec68f2de -H 'Content-Type: application/json' -i -k
The ...
Read now
Unlock full access