Skip to content

Commit

Permalink
In ix bid adapter, default to assuming media type is banner (prebid#2632
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dumbmatter authored and AlessandroDG committed Sep 13, 2018
1 parent 65918bc commit f0c141a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export const spec = {

// If the bid request is for banner, then transform the bid request based on banner format.
if (utils.deepAccess(validBidRequest, 'mediaTypes.banner') ||
validBidRequest.mediaType === 'banner') {
validBidRequest.mediaType === 'banner' ||
(validBidRequest.mediaType === undefined && utils.deepAccess(validBidRequest, 'mediaTypes.banner') === undefined)) {
bannerImp = bidToBannerImp(validBidRequest);
bannerImps.push(bannerImp);
}
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,21 @@ describe('IndexexchangeAdapter', () => {

expect(requestStringTimeout.data.t).to.be.undefined;
});

it('should default to assuming media type is banner', () => {
const bidsWithoutMediaType = [
Object.assign({}, DEFAULT_BANNER_VALID_BID[0])
];
delete bidsWithoutMediaType[0].mediaTypes;

const request = spec.buildRequests(bidsWithoutMediaType);
const payload = JSON.parse(request.data.r);

expect(payload.id).to.equal(bidsWithoutMediaType[0].bidderRequestId);
expect(payload.imp).to.exist;
expect(payload.imp).to.be.an('array');
expect(payload.imp).to.have.lengthOf(1);
});
});

describe('interpretResponseBanner', () => {
Expand Down

0 comments on commit f0c141a

Please sign in to comment.