building-microservices-youtube
building-microservices-youtube copied to clipboard
Delete product doesn't work properly
Given a list of products like:
⟩ curl localhost:9090/products | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 630 100 630 0 0 615k 0 --:--:-- --:--:-- --:--:-- 615k
[
{
"id": 1,
"name": "Latte",
"description": "Frothy milky coffee",
"price": 2.45,
"sku": "abc323"
},
{
"id": 2,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
},
{
"id": 3,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
},
{
"id": 4,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
},
{
"id": 5,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
},
{
"id": 6,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
}
]
After deleting one of them the list is not updated as expected:
⟩ curl localhost:9090/products/2 -XDELETE
⟩ curl localhost:9090/products | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 198 100 198 0 0 66000 0 --:--:-- --:--:-- --:--:-- 99000
[
{
"id": 1,
"name": "Latte",
"description": "Frothy milky coffee",
"price": 2.45,
"sku": "abc323"
},
{
"id": 3,
"name": "Esspresso",
"description": "Short and strong coffee without milk",
"price": 1.99,
"sku": "fjd34"
}
]