Skip to content

Commit

Permalink
StroeerCore Bid Adapter: use a random UUID for the request id (prebid…
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwatson authored and Santiago Carabone committed Aug 22, 2023
1 parent 6db6767 commit 7fca090
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 2 additions & 3 deletions modules/stroeerCoreBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {buildUrl, deepAccess, getWindowSelf, getWindowTop, isEmpty, isStr, logWarn} from '../src/utils.js';
import { buildUrl, deepAccess, generateUUID, getWindowSelf, getWindowTop, isEmpty, isStr, logWarn } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {find} from '../src/polyfill.js';
Expand Down Expand Up @@ -50,8 +50,7 @@ export const spec = {
const refererInfo = bidderRequest.refererInfo;

const basePayload = {
// TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
id: bidderRequest.auctionId,
id: generateUUID(),
ref: refererInfo.ref,
ssl: isSecureWindow(),
mpa: isMainPageAccessible(),
Expand Down
13 changes: 8 additions & 5 deletions test/spec/modules/stroeerCoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {spec} from 'modules/stroeerCoreBidAdapter.js';
import * as utils from 'src/utils.js';
import {BANNER, VIDEO} from '../../../src/mediaTypes.js';
import {find} from 'src/polyfill.js';
import sinon from 'sinon';

describe('stroeerCore bid adapter', function () {
let sandbox;
Expand Down Expand Up @@ -51,8 +52,6 @@ describe('stroeerCore bid adapter', function () {
assert.notProperty(bidObject, 'ad');
}

const AUCTION_ID = utils.getUniqueIdentifierStr();

// Vendor user ids and associated data
const userIds = Object.freeze({
criteoId: 'criteo-user-id',
Expand All @@ -72,7 +71,6 @@ describe('stroeerCore bid adapter', function () {
});

const buildBidderRequest = () => ({
auctionId: AUCTION_ID,
bidderRequestId: 'bidder-request-id-123',
bidderCode: 'stroeerCore',
timeout: 5000,
Expand Down Expand Up @@ -394,14 +392,18 @@ describe('stroeerCore bid adapter', function () {
clock.tick(13500);
const bidReq = buildBidderRequest();

const UUID = 'fb6a39e3-083f-424c-9046-f1095e15f3d5';

const generateUUIDStub = sinon.stub(utils, 'generateUUID').returns(UUID);

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);

const expectedTimeout = bidderRequest.timeout - (13500 - bidderRequest.auctionStart);

assert.equal(expectedTimeout, 1500);

const expectedJsonPayload = {
'id': AUCTION_ID,
'id': UUID,
'timeout': expectedTimeout,
'ref': 'https://www.example.com/?search=monkey',
'mpa': true,
Expand Down Expand Up @@ -429,8 +431,9 @@ describe('stroeerCore bid adapter', function () {

// trim away fields with undefined
const actualJsonPayload = JSON.parse(JSON.stringify(serverRequestInfo.data));

assert.deepEqual(actualJsonPayload, expectedJsonPayload);

generateUUIDStub.restore();
});

describe('video bids', () => {
Expand Down

0 comments on commit 7fca090

Please sign in to comment.