From 4596f59b79788993a16b1836be1881d0943cbb38 Mon Sep 17 00:00:00 2001 From: MichaelHeerklotz Date: Wed, 17 Jul 2019 06:13:56 +0200 Subject: Fix missing 3rd party cookie when using POST requests (#14368) * Fix missing 3rd party cookie when using POST requests * fix test * jslint fix * Update piwik.min.js * Update matomo.js * Update piwik.js --- tests/javascript/index.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/javascript') diff --git a/tests/javascript/index.php b/tests/javascript/index.php index cdb17efb8a..d8362dbb58 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -3293,6 +3293,30 @@ function PiwikTest() { ok( -1 !== tracker.getRequest('hello=world').indexOf('send_image=0'), 'should disable sending image response'); }); + test("POST requests are sent with cookies", function() { + expect(3); + + var tracker = Piwik.getTracker(); + tracker.setTrackerUrl("matomo.php"); + tracker.setSiteId(1); + tracker.setCustomData({ "token": '---' }); + tracker.setRequestMethod('POST'); + + var callbackCalled = false; + tracker.trackPageView('withCredentialsTest', null, function (event) { + callbackCalled = true; + ok(event.success, 'succeeded'); + ok(event.xhr && event.xhr.withCredentials, 'withCredentials is true'); + }); + + stop(); + setTimeout(function() { + ok(callbackCalled, 'called the callback'); + + start(); + }, 2000); + }); + // support for setCustomRequestProcessing( customRequestContentProcessingLogic ) test("Tracker setCustomRequestProcessing() and getRequest()", function() { expect(4); -- cgit v1.2.3