ttu / dotnet-fake-json-server

Fake JSON Server is a Fake REST API that can be used as a Back End for prototyping or as a template for a CRUD Back End.
https://ttu.github.io/dotnet-fake-json-server/
MIT License
388 stars 84 forks source link

DELETE operations put server in Bad State #68

Closed Shanjaq closed 4 years ago

Shanjaq commented 4 years ago

DELETE /api/{collection}/{id} succeeds only once. If there are other collections, server will return 500.

Sample data.json:

{
  "tests": [
    {
      "value": [
        "Test1"
      ],
      "id": 0
    }
  ],
  "items": [
    {
      "description": "some_description",
      "createdDate": "0001-01-01T00:00:00",
      "id": 0
    }
  ],
  "programs": [
    {
      "id": 0,
      "canOverride": false,
      "enabled": true,
      "version": null
    }
  ]
}

Operation 1 DELETE /api/tests/0 result: 204

Operation 2 DELETE /api/items/0 result: 500

ttu commented 4 years ago

Thanks for the issue! Will make the fix to https://github.com/ttu/json-flatfile-datastore

(edit: Fixed in commit https://github.com/ttu/json-flatfile-datastore/commit/5c2ec8174cac39fd01fd5908769fb5538946f336)