Skip to content

Commit c8b5e19

Browse files
committed
add tests
1 parent b682008 commit c8b5e19

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

modules/dasBidAdapter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export const spec = {
274274
const baseUrl = getEndpoint(data.ext.network);
275275
const fullUrl = `${baseUrl}?data=${encodeURIComponent(jsonData)}`;
276276

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

279280
// Switch to POST if URL exceeds 8k characters

test/spec/modules/dasBidAdapter_spec.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,35 @@ describe('dasBidAdapter', function () {
265265
expect(payload.ext.network).to.equal('network1');
266266
});
267267

268+
it('should set withCredentials to false when adbeta flag is present', function () {
269+
const bidRequestsWithAdbeta = [{
270+
bidId: 'bid123',
271+
params: {
272+
site: 'site1',
273+
area: 'area1',
274+
slot: 'slot1',
275+
network: 'network1',
276+
adbeta: 'l1021885!slot.nativestd',
277+
pageContext: {}
278+
},
279+
mediaTypes: {
280+
banner: {
281+
sizes: [[300, 250]]
282+
}
283+
}
284+
}];
285+
286+
const bidderRequestWithAdbeta = {
287+
bidderRequestId: 'reqId123',
288+
ortb2: {},
289+
adbeta: true
290+
};
291+
292+
const request = spec.buildRequests(bidRequestsWithAdbeta, bidderRequestWithAdbeta);
293+
294+
expect(request.options.withCredentials).to.be.false;
295+
});
296+
268297
describe('interpretResponse', function () {
269298
const serverResponse = {
270299
body: {

0 commit comments

Comments
 (0)