Skip to content

Commit a5e7bf2

Browse files
authored
Merge pull request #29 from NHSDigital/apm-2078-fix-status-logging-to-splunk
APM-2078 set status.response
2 parents 5f25139 + 9ea3f62 commit a5e7bf2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true
1919

2020
const final_status = (healthcheck_status !== "pass") ? "fail" : "pass";
2121

22-
// context.setVariable("status.response", JSON.stringify(response));
23-
context.setVariable("response.content", JSON.stringify( {
22+
const resp = {
2423
"status" : final_status,
2524
"version" : "{{ DEPLOYED_VERSION }}" ,
2625
"revision" : apiproxy_revision,
@@ -35,6 +34,8 @@ context.setVariable("response.content", JSON.stringify( {
3534
"links" : {"self": healthcheck_request_url}
3635
}
3736
}
38-
}));
37+
};
3938

39+
context.setVariable("status.response", JSON.stringify(resp));
40+
context.setVariable("response.content", JSON.stringify(resp));
4041
context.setVariable("response.header.Content-Type", "application/json");

proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true
1919

2020
const final_status = (healthcheck_status !== "pass") ? "fail" : "pass";
2121

22-
// context.setVariable("status.response", JSON.stringify(response));
23-
context.setVariable("response.content", JSON.stringify( {
22+
const resp = {
2423
"status" : final_status,
2524
"version" : "{{ DEPLOYED_VERSION }}" ,
2625
"revision" : apiproxy_revision,
@@ -35,6 +34,8 @@ context.setVariable("response.content", JSON.stringify( {
3534
"links" : {"self": healthcheck_request_url}
3635
}
3736
}
38-
}));
37+
};
3938

39+
context.setVariable("status.response", JSON.stringify(resp));
40+
context.setVariable("response.content", JSON.stringify(resp));
4041
context.setVariable("response.header.Content-Type", "application/json");

0 commit comments

Comments
 (0)