Don't respond to a request twice if an entity has not been found.

This commit is contained in:
Dominik Henneke
2021-02-05 19:41:39 +01:00
parent 59b1b04f0b
commit fb53eb7cb4
2 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Don't respond to a request twice if an entity has not been found.
@@ -76,8 +76,9 @@ export async function createRouter(
);
if (!entities.length) {
res.status(404).send(`No entity with uid ${uid}`);
} else {
res.status(200).send(entities[0]);
}
res.status(200).send(entities[0]);
})
.delete('/entities/by-uid/:uid', async (req, res) => {
const { uid } = req.params;
@@ -99,8 +100,9 @@ export async function createRouter(
.send(
`No entity with kind ${kind} namespace ${namespace} name ${name}`,
);
} else {
res.status(200).send(entities[0]);
}
res.status(200).send(entities[0]);
});
}