building-microservices-youtube icon indicating copy to clipboard operation
building-microservices-youtube copied to clipboard

Delete product doesn't work properly

Open szaffarano opened this issue 5 years ago • 0 comments

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"
  }
]

szaffarano avatar Sep 20 '20 23:09 szaffarano