Skip to content

Commit 7d890ae

Browse files
authored
Merge pull request DSpace#5677 from DSpace/backport-5673-to-dspace-8_x
[Port dspace-8_x] Fix DSpace#5672: resolve health check issue with response handling
2 parents 8d3e122 + e0f098e commit 7d890ae

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,12 @@ function healthCheck(req, res) {
674674
const baseUrl = `${REST_BASE_URL}${environment.actuators.endpointPath}`;
675675
fetch(baseUrl)
676676
.then((response) => {
677-
res.status(response.status).send(response);
677+
return response.json().then((data) => {
678+
res.status(response.status).send(data);
679+
});
678680
})
679681
.catch((error) => {
680-
res.status(error.response.status).send({
682+
res.status(error?.response?.status || 503).send({
681683
error: error.message,
682684
});
683685
});

0 commit comments

Comments
 (0)