fix: sendBeacon 415 error - wrap payload in Blob with application/json
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
navigator.sendBeacon() with a string sends text/plain Content-Type, causing Flask to reject with 415 Unsupported Media Type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fc1109a74d
commit
5a51142cfe
6
static/js/analytics-tracker.min.js
vendored
6
static/js/analytics-tracker.min.js
vendored
@ -69,12 +69,12 @@ type: 'page_time',
|
||||
page_view_id: currentPageViewId,
|
||||
time_seconds: timeOnPage
|
||||
});
|
||||
navigator.sendBeacon(TRACK_ENDPOINT, data);
|
||||
navigator.sendBeacon(TRACK_ENDPOINT, new Blob([data], {type: 'application/json'}));
|
||||
if (maxScrollDepth > 0) {
|
||||
navigator.sendBeacon(SCROLL_ENDPOINT, JSON.stringify({
|
||||
navigator.sendBeacon(SCROLL_ENDPOINT, new Blob([JSON.stringify({
|
||||
page_view_id: currentPageViewId,
|
||||
scroll_depth: maxScrollDepth
|
||||
}));
|
||||
})], {type: 'application/json'}));
|
||||
}
|
||||
}
|
||||
function handleVisibilityChange() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user