diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index deb091fb2b7..a48e3c0fde3 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -483,7 +483,10 @@ function hasPurpose1Consent(bidderRequest) { function formatRequest(payload, bidderRequest) { let request = []; - let options = {}; + let options = { + withCredentials: true + }; + let endpointUrl = URL; if (!hasPurpose1Consent(bidderRequest)) { diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index 935bc23be03..2b7c5835604 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -644,7 +644,7 @@ describe('AppNexusAdapter', function () { bidderRequest.bids = bidRequests; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.options).to.be.empty; + expect(request.options).to.deep.equal({withCredentials: true}); const payload = JSON.parse(request.data); expect(payload.gdpr_consent).to.exist; @@ -796,6 +796,12 @@ describe('AppNexusAdapter', function () { config.getConfig.restore(); }); + it('should always set withCredentials: true on the request.options', function () { + let bidRequest = Object.assign({}, bidRequests[0]); + const request = spec.buildRequests([bidRequest]); + expect(request.options.withCredentials).to.equal(true); + }); + it('should set simple domain variant if purpose 1 consent is not given', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = {