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 dluxemburg committed Jul 17, 2018
1 parent 3f4c49c commit 65b0756
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 65b0756

Please sign in to comment.