Skip to content

Commit

Permalink
Merge pull request #2 from sovrn/hs-303_Send_iv_param_legacy
Browse files Browse the repository at this point in the history
Send 'iv' param if present
  • Loading branch information
aprakash-sovrn authored Feb 14, 2018
2 parents 7589fa2 + 44b2f94 commit d7dfb88
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/sovrnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ export const spec = {
*/
buildRequests: function(bidReqs) {
let sovrnImps = [];
let iv;
utils._each(bidReqs, function (bid) {
sovrnImps.push({
id: bid.bidId,
banner: { w: 1, h: 1 },
tagid: utils.getBidIdParameter('tagid', bid.params),
bidfloor: utils.getBidIdParameter('bidfloor', bid.params)
});
iv = iv || utils.getBidIdParameter('iv', bid.params);
});
const sovrnBidReq = {
id: utils.getUniqueIdentifierStr(),
imp: sovrnImps,
site: {
domain: window.location.host,
page: window.location.pathname + location.search + location.hash
page: window.location.host + window.location.pathname + location.search + location.hash
}
};
if (iv) sovrnBidReq.iv = iv;
return {
method: 'POST',
url: `//ap.lijit.com/rtb/bid?src=${REPO_AND_VERSION}`,
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/sovrnBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ describe('sovrnBidAdapter', function() {
it('attaches source and version to endpoint URL as query params', () => {
expect(request.url).to.equal(ENDPOINT)
});

it('sends \'iv\' as query param if present', () => {
const ivBidRequests = [{
'bidder': 'sovrn',
'params': {
'tagid': '403370',
'iv': 'vet'
},
'adUnitCode': 'adunit-code',
'sizes': [
[300, 250]
],
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475'
}];
const request = spec.buildRequests(ivBidRequests);

expect(request.data).to.contain('"iv":"vet"')
})
});

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

0 comments on commit d7dfb88

Please sign in to comment.