Skip to content

Commit

Permalink
Dailymotion bid adapter: Fix user sync parsing (prebid#11887)
Browse files Browse the repository at this point in the history
This fixes an issue in the server response parsing for user sync, where it was not using the body from the response. I took the occasion to also convert this member to camelCase for consistency with the others.

Co-authored-by: Kevin Siow <kevin.siow@dailymotion.com>
  • Loading branch information
2 people authored and DecayConstant committed Jul 18, 2024
1 parent b84858e commit 19bac78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const spec = {
const pixelSyncs = [];

serverResponses.forEach((response) => {
(response.user_syncs || []).forEach((syncUrl) => {
(response?.body?.userSyncs || []).forEach((syncUrl) => {
if (syncUrl.type === 'image') {
pixelSyncs.push({ url: syncUrl.url, type: 'image' });
}
Expand Down
32 changes: 18 additions & 14 deletions test/spec/modules/dailymotionBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe('dailymotionBidAdapterTests', () => {

// No permissions
{
const responses = [{ user_syncs: [{ url: 'https://usersyncurl.com', type: 'image' }] }];
const responses = [{ body: { userSyncs: [{ url: 'https://usersyncurl.com', type: 'image' }] } }];
const syncOptions = { iframeEnabled: false, pixelEnabled: false };

expect(config.runWithBidder(
Expand All @@ -656,7 +656,7 @@ describe('dailymotionBidAdapterTests', () => {
)).to.eql([]);
}

// Has permissions but no user_syncs urls
// Has permissions but no userSyncs urls
{
const responses = [{}];
const syncOptions = { iframeEnabled: false, pixelEnabled: true };
Expand All @@ -667,14 +667,16 @@ describe('dailymotionBidAdapterTests', () => {
)).to.eql([]);
}

// Return user_syncs urls for pixels
// Return userSyncs urls for pixels
{
const responses = [{
user_syncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
body: {
userSyncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
}
}];

const syncOptions = { iframeEnabled: false, pixelEnabled: true };
Expand All @@ -688,14 +690,16 @@ describe('dailymotionBidAdapterTests', () => {
]);
}

// Return user_syncs urls for iframes
// Return userSyncs urls for iframes
{
const responses = [{
user_syncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
body: {
userSyncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
}
}];

const syncOptions = { iframeEnabled: true, pixelEnabled: true };
Expand Down

0 comments on commit 19bac78

Please sign in to comment.