Skip to content

Commit 13f8566

Browse files
Mattia VianelliAndrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2025_02_x/DSC-2868 (pull request DSpace#4491)
DSC-2868 fix(health): parse fetch Response body in healthCheck endpoint Approved-by: Andrea Barbasso
2 parents 7944633 + 52769da commit 13f8566

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
@@ -719,10 +719,12 @@ function healthCheck(req, res) {
719719
const baseUrl = `${REST_BASE_URL}${environment.actuators.endpointPath}`;
720720
fetch(baseUrl)
721721
.then((response) => {
722-
res.status(response.status).send(response);
722+
return response.json().then((data) => {
723+
res.status(response.status).send(data);
724+
});
723725
})
724726
.catch((error) => {
725-
res.status(error.response.status).send({
727+
res.status(error?.response?.status || 503).send({
726728
error: error.message,
727729
});
728730
});

0 commit comments

Comments
 (0)