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

Rubicon Bid Adapter: Fix some video request params #5799

Merged
merged 1 commit into from
Oct 5, 2020
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
4 changes: 2 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ export const spec = {
source: {
tid: bidRequest.transactionId
},
tmax: config.getConfig('TTL') || 1000,
tmax: bidderRequest.timeout,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still want to default to 1000?

imp: [{
exp: 300,
exp: config.getConfig('s2sConfig.defaultTtl'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there always an s2sConfig (with defaultTtl) when video is used? If not, I guess we want to send undefined?

id: bidRequest.adUnitCode,
secure: 1,
ext: {
Expand Down
36 changes: 33 additions & 3 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,11 +1593,11 @@ describe('the rubicon adapter', function () {
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

expect(post).to.have.property('imp')
expect(post).to.have.property('imp');
// .with.length.of(1);
let imp = post.imp[0];
expect(imp.id).to.equal(bidderRequest.bids[0].adUnitCode);
expect(imp.exp).to.equal(300);
expect(imp.exp).to.equal(undefined); // now undefined
expect(imp.video.w).to.equal(640);
expect(imp.video.h).to.equal(480);
expect(imp.video.pos).to.equal(1);
Expand Down Expand Up @@ -1750,6 +1750,36 @@ describe('the rubicon adapter', function () {
expect(request.data.imp[0].ext).to.not.haveOwnProperty('rubicon');
});

it('should send video exp param correctly when set', function () {
createVideoBidderRequest();
config.setConfig({s2sConfig: {defaultTtl: 600}});
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

// should exp set to the right value according to config
let imp = post.imp[0];
expect(imp.exp).to.equal(600);
});

it('should not send video exp at all if not set in s2sConfig config', function () {
createVideoBidderRequest();
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

// should exp set to the right value according to config
let imp = post.imp[0];
// bidderFactory stringifies request body before sending so removes undefined attributes:
expect(imp.exp).to.equal(undefined);
});

it('should send tmax as the bidderRequest timeout value', function () {
createVideoBidderRequest();
bidderRequest.timeout = 3333;
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;
expect(post.tmax).to.equal(3333);
});

it('should send correct bidfloor to PBS', function () {
createVideoBidderRequest();

Expand Down Expand Up @@ -2099,7 +2129,7 @@ describe('the rubicon adapter', function () {
// .with.length.of(1);
let imp = post.imp[0];
expect(imp.id).to.equal(bidderRequest.bids[0].adUnitCode);
expect(imp.exp).to.equal(300);
expect(imp.exp).to.equal(undefined);
expect(imp.video.w).to.equal(640);
expect(imp.video.h).to.equal(480);
expect(imp.video.pos).to.equal(1);
Expand Down