Don't respond to a request twice if an entity has not been found.
This commit is contained in:
@@ -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]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user