Skip to content

Commit

Permalink
We want to remove bidfloor if not set by pb (prebid#3866)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored and Alex committed Aug 1, 2019
1 parent f7963b5 commit 2870714
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export const spec = {
},
tmax: config.getConfig('TTL') || 1000,
imp: [{
bidfloor: utils.deepAccess(bidRequest, 'params.floor') ? parseFloat(bidRequest.params.floor) : 0.0,
exp: 300,
id: bidRequest.adUnitCode,
secure: isSecure() || bidRequest.params.secure ? 1 : 0,
Expand All @@ -159,6 +158,10 @@ export const spec = {
}
}
}
const bidFloor = parseFloat(utils.deepAccess(bidRequest, 'params.floor'));
if (!isNaN(bidFloor)) {
data.imp[0].bidfloor = bidFloor;
}
// if value is set, will overwrite with same value
data.imp[0].ext.rubicon.video.size_id = determineRubiconVideoSizeId(bidRequest)

Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,15 +1160,15 @@ describe('the rubicon adapter', function () {

bidderRequest.bids[0].params.floor = 0;
[request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(request.data.imp[0].bidfloor).to.equal(0.0);
expect(request.data.imp[0].bidfloor).to.equal(0);

bidderRequest.bids[0].params.floor = undefined;
[request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(request.data.imp[0].bidfloor).to.equal(0.0);
expect(request.data.imp[0]).to.not.haveOwnProperty('bidfloor');

bidderRequest.bids[0].params.floor = null;
[request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(request.data.imp[0].bidfloor).to.equal(0.0);
expect(request.data.imp[0]).to.not.haveOwnProperty('bidfloor');
});

it('should send request with proper ad position when mediaTypes.video.pos is not defined', function () {
Expand Down

0 comments on commit 2870714

Please sign in to comment.