Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gumgum Bid Adapter: remove slotid type checking #7420

Merged
merged 2 commits into from
Sep 15, 2021
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
8 changes: 4 additions & 4 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ function buildRequests(validBidRequests, bidderRequest) {
const [maxw, maxh] = getGreatestDimensions(sizes);
data.maxw = maxw;
data.maxh = maxh;
data.si = parseInt(params.slot, 10);
data.si = params.slot;
data.pi = 3;
data.bf = sizes.reduce((acc, curSlotDim) => `${acc}${acc && ','}${curSlotDim[0]}x${curSlotDim[1]}`, '');
} else if (params.native) {
data.ni = parseInt(params.native, 10);
data.ni = params.native;
data.pi = 5;
} else if (mediaTypes.video) {
data.pi = mediaTypes.video.linearity === 2 ? 6 : 7; // invideo : video
Expand Down Expand Up @@ -391,12 +391,12 @@ function handleLegacyParams(params, sizes) {
const [maxw, maxh] = getGreatestDimensions(sizes);
data.maxw = maxw;
data.maxh = maxh;
data.si = parseInt(params.inSlot, 10);
data.si = params.inSlot;
data.pi = 3;
data.bf = sizes.reduce((acc, curSlotDim) => `${acc}${acc && ','}${curSlotDim[0]}x${curSlotDim[1]}`, '');
}
if (params.ICV) {
data.ni = parseInt(params.ICV, 10);
data.ni = params.ICV;
data.pi = 5;
}
if (params.videoPubID) {
Expand Down
22 changes: 21 additions & 1 deletion test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,27 @@ describe('gumgumAdapter', function () {
expect(slotZoneBidRequest.data.maxh).to.equal(600);
expect(slotPubIdBidRequest.data.maxw).to.equal(300);
expect(slotPubIdBidRequest.data.maxh).to.equal(600);
})
});

// if slot ID is set up incorrectly by a pub, we should send the invalid ID to be
// invalidated by ad server instead of trying to force integer type. forcing
// integer type can result in incorrect slot IDs that correlate to the incorrect pub ID
it('should send params.slot or params.inSlot as string when configured incorrectly', function () {
const invalidSlotId = '9gkal1cn';
const slotRequest = { ...bidRequests[0] };
const legacySlotRequest = { ...bidRequests[0] };
let req;
let legReq;

slotRequest.params.slot = invalidSlotId;
legacySlotRequest.params.inSlot = invalidSlotId;

req = spec.buildRequests([ slotRequest ])[0];
legReq = spec.buildRequests([ legacySlotRequest ])[0];

expect(req.data.si).to.equal(invalidSlotId);
expect(legReq.data.si).to.equal(invalidSlotId);
});

it('should set the iriscat param when found', function () {
const request = { ...bidRequests[0], params: { iriscat: 'abc123' } }
Expand Down