Skip to content

Commit

Permalink
Merge pull request #487 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 Apr 23, 2024
2 parents b2e3a90 + 4934207 commit 01c7900
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 24.4.0
- Improved Health Check feature stability
- Added support for Feedback Widget terms and conditions

## 23.12.6
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/health_check.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 lib/countly.js
Original file line number Diff line number Diff line change
Expand Up @@ -5335,12 +5335,16 @@
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 01c7900

Please sign in to comment.