diff --git a/modules/automatadBidAdapter.js b/modules/automatadBidAdapter.js index e3d0d87783a..d3aeb204d5e 100644 --- a/modules/automatadBidAdapter.js +++ b/modules/automatadBidAdapter.js @@ -74,7 +74,7 @@ export const spec = { data: payloadString, options: { contentType: 'application/json', - withCredentials: false, + withCredentials: true, crossOrigin: true, }, } @@ -114,7 +114,7 @@ export const spec = { }, onTimeout: function(timeoutData) { const timeoutUrl = ENDPOINT_URL + '/timeout' - ajax(timeoutUrl, null, JSON.stringify(timeoutData)) + spec.ajaxCall(timeoutUrl, null, JSON.stringify(timeoutData), {method: 'POST', withCredentials: true}) }, onBidWon: function(bid) { if (!bid.nurl) { return } @@ -136,11 +136,15 @@ export const spec = { /\$\{AUCTION_ID\}/, bid.auctionId ) - spec.ajaxCall(winUrl, null) + spec.ajaxCall(winUrl, null, null, {method: 'GET', withCredentials: true}) return true }, - ajaxCall: function(endpoint, data) { - ajax(endpoint, data) + + ajaxCall: function(endpoint, callback, data, options = {}) { + if (data) { + options.contentType = 'application/json' + } + ajax(endpoint, callback, data, options) }, } diff --git a/test/spec/modules/automatadBidAdapter_spec.js b/test/spec/modules/automatadBidAdapter_spec.js index 09bfb96e8b9..e7b68b739c7 100644 --- a/test/spec/modules/automatadBidAdapter_spec.js +++ b/test/spec/modules/automatadBidAdapter_spec.js @@ -96,6 +96,10 @@ describe('automatadBidAdapter', function () { let req = spec.buildRequests([ bidRequestRequiredParams ], { refererInfo: { } }) let rdata + it('should have withCredentials option as true', function() { + expect(req.options.withCredentials).to.equal(true) + }) + it('should return request object', function () { expect(req).to.not.be.null })