Skip to content

Commit

Permalink
Merge pull request #134 from adobe/beaconheader
Browse files Browse the repository at this point in the history
fix: add json type header to beacon
  • Loading branch information
trieloff authored Mar 11, 2024
2 parents bd20f7f + a1e0807 commit 188d543
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ function trackCheckpoint(checkpoint, data, t) {
// eslint-disable-next-line object-curly-newline, max-len
const body = JSON.stringify({ weight, id, sanitizeURL: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'], checkpoint, t, ...data }, KNOWN_PROPERTIES);
const url = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL || sampleRUM.baseURL).href;
navigator.sendBeacon(url, body);
const headers = { type: 'application/json' };
navigator.sendBeacon(url, new Blob([body], headers));
// eslint-disable-next-line no-console
console.debug(`ping:${checkpoint}`, pdata);
};
Expand Down

0 comments on commit 188d543

Please sign in to comment.