Skip to content

Commit

Permalink
Merge pull request #14 from Countly/hc-empty-string-issue
Browse files Browse the repository at this point in the history
HC empty string issue
  • Loading branch information
turtledreams authored Jun 11, 2024
2 parents b464d35 + fe04aef commit 040d8d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/health_check.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("Health Check tests ", () => {
// Test the 'hc' parameter
const hcParam = url.searchParams.get("hc");
const hcParamObj = JSON.parse(hcParam);
expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "\"\"" });
expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "" });

// Test the 'metrics' parameter
const metricsParam = url.searchParams.get("metrics");
Expand Down
6 changes: 5 additions & 1 deletion modules/CountlyClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -4755,12 +4755,16 @@ class CountlyClass {
function sendInstantHCRequest() {
// truncate error message to 1000 characters
var curbedMessage = truncateSingleValue(self.hcErrorMessage, 1000, "healthCheck", log);
// due to some server issues we pass empty string as is
if (curbedMessage !== "") {
curbedMessage = JSON.stringify(curbedMessage);
}
// prepare hc object
var hc = {
el: self.hcErrorCount,
wl: self.hcWarningCount,
sc: self.hcStatusCode,
em: JSON.stringify(curbedMessage)
em: curbedMessage
};
// prepare request
var request = {
Expand Down

0 comments on commit 040d8d2

Please sign in to comment.