Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions modules/dasBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,17 @@ export const spec = {
const baseUrl = getEndpoint(data.ext.network);
const fullUrl = `${baseUrl}?data=${encodeURIComponent(jsonData)}`;

// adbeta needs credentials omitted to avoid CORS issues, especially in Firefox
const useCredentials = !(!!data.ext?.adbeta);

// Switch to POST if URL exceeds 8k characters
if (fullUrl.length > 8192) {
return {
method: 'POST',
url: baseUrl,
data: jsonData,
options: {
withCredentials: true,
withCredentials: useCredentials,
crossOrigin: true,
customHeaders: {
'Content-Type': 'text/plain'
Expand All @@ -355,7 +358,7 @@ export const spec = {
method: 'GET',
url: fullUrl,
options: {
withCredentials: true,
withCredentials: useCredentials,
crossOrigin: true,
},
};
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/dasBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,35 @@ describe('dasBidAdapter', function () {
expect(payload.ext.network).to.equal('network1');
});

it('should set withCredentials to false when adbeta flag is present', function () {
const bidRequestsWithAdbeta = [{
bidId: 'bid123',
params: {
site: 'site1',
area: 'area1',
slot: 'slot1',
network: 'network1',
adbeta: 'l1021885!slot.nativestd',
pageContext: {}
},
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
}
}];

const bidderRequestWithAdbeta = {
bidderRequestId: 'reqId123',
ortb2: {},
adbeta: true
};

const request = spec.buildRequests(bidRequestsWithAdbeta, bidderRequestWithAdbeta);

expect(request.options.withCredentials).to.be.false;
});

describe('interpretResponse', function () {
const serverResponse = {
body: {
Expand Down
Loading