Skip to content

Commit

Permalink
Change http status code from 500 to 503 (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejmodzelewski authored Oct 7, 2022
1 parent 4a08f53 commit 960765e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion healthcheck/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function configure (config) {
results,
{ buildInfo }
)
const status = allOk ? 200 : 500
const status = allOk ? 200 : 503
if (!allOk) {
const downHealthChecks = Object.values(results)
.filter(result => result.status === outputs.DOWN)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/nodejs-healthcheck",
"version": "1.7.3",
"version": "1.8.0",
"description": "Healthcheck endpoint for Reform nodejs applications",
"main": "index.js",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/routesTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ describe('Routes', () => {
return route(req, res)
})

it('should return 500 DOWN if any checks fail', () => {
it('should return 503 DOWN if any checks fail', () => {
const route = routes.configure({
checks: {
check1: makeCheck(false),
check2: makeCheck(true)
}
})
const [req, res] = makeReqRes(500, {
const [req, res] = makeReqRes(503, {
status: 'DOWN',
check1: { status: 'DOWN' },
check2: { status: 'UP' },
Expand Down

0 comments on commit 960765e

Please sign in to comment.