From bf6f34839c7deaa22eef202094b397ca3e504397 Mon Sep 17 00:00:00 2001 From: James Chartrand Date: Thu, 5 Sep 2024 07:45:12 -0400 Subject: [PATCH] return 405 when status service disabled --- src/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index d99323e..f9545bf 100644 --- a/src/app.js +++ b/src/app.js @@ -134,6 +134,7 @@ export async function build (opts = {}) { }) app.get('/status/:statusCredentialId', async function (req, res, next) { + if (!enableStatusService) return res.status(405).send('The status service has not been enabled.') const statusCredentialId = req.params.statusCredentialId try { const { data: statusCredential } = await axios.get(`http://${statusService}/${statusCredentialId}`) @@ -144,7 +145,7 @@ export async function build (opts = {}) { code: error.code }) } - return res.status(200).send({ message: 'status service is not configured.' }) + return res.status(500).send({ message: 'Server error.' }) }) // Attach the error handling middleware calls, in order they should run