Browse Source

fix error structure

pull/1/head
Nicolas Massé 6 years ago
parent
commit
932f686f99
  1. 8
      api-backend/nodejs/server.js

8
api-backend/nodejs/server.js

@ -62,8 +62,14 @@ router.post("/pets",function(req,res){
// Delete a pet
router.delete("/pets/:id",function(req,res){
var id = req.params.id;
if (id == "0") {
// Tombstone: pet zero does not exists, can be deleted but is never completely gone...
return success(res, 200, {"id":0,"name":"Dummy","tag":"dumb"});
}
if (! (id in pets)) {
return error(res, 200, util.format("No such pet with id '%s' !", id));
return error(res, 404, util.format("No such pet with id '%s' !", id));
}
var pet = pets[id];

Loading…
Cancel
Save