Skip to content

Commit

Permalink
use same adUnits copy for s2s in callBids that we made in makeBidRequ…
Browse files Browse the repository at this point in the history
…ests (#1940)
  • Loading branch information
snapwich authored Dec 8, 2017
1 parent 377c4c2 commit 8292bb1
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/adaptermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ exports.makeBidRequests = function(adUnits, auctionStart, auctionId, cbTimeout,
auctionId,
bidderRequestId,
tid,
adUnitsS2SCopy,
bids: getBids({bidderCode, auctionId, bidderRequestId, 'adUnits': adUnitsS2SCopy, labels}),
auctionStart: auctionStart,
timeout: _s2sConfig.timeout,
Expand Down Expand Up @@ -227,9 +228,10 @@ exports.callBids = (adUnits, bidRequests, addBidResponse, doneCb) => {
let adaptersServerSide = _s2sConfig.bidders;
const s2sAdapter = _bidderRegistry[_s2sConfig.adapter];
let tid = serverBidRequests[0].tid;
let adUnitsS2SCopy = serverBidRequests[0].adUnitsS2SCopy;

if (s2sAdapter) {
let s2sBidRequest = {tid, 'ad_units': getAdUnitCopyForPrebidServer(adUnits)};
let s2sBidRequest = {tid, 'ad_units': adUnitsS2SCopy};
if (s2sBidRequest.ad_units.length) {
let doneCbs = serverBidRequests.map(bidRequest => {
bidRequest.doneCbCallCount = 0;
Expand Down
156 changes: 156 additions & 0 deletions test/spec/unit/core/adapterManager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,84 @@ describe('adapterManager tests', () => {
'bidderRequestId': '2946b569352ef2',
'tid': '34566b569352ef2',
'src': 's2s',
'adUnitsS2SCopy': [
{
'code': '/19968336/header-bid-tag1',
'sizes': [
{
'w': 728,
'h': 90
},
{
'w': 970,
'h': 90
}
],
'bids': [
{
'bidder': 'appnexus',
'params': {
'placementId': '543221',
'test': 'me'
},
'placementCode': '/19968336/header-bid-tag1',
'sizes': [
[
728,
90
],
[
970,
90
]
],
'bidId': '68136e1c47023d',
'bidderRequestId': '55e24a66bed717',
'requestId': '1ff753bd4ae5cb',
'startTime': 1463510220995,
'status': 1,
'bid_id': '378a8914450b334'
}
]
},
{
'code': '/19968336/header-bid-tag-0',
'sizes': [
{
'w': 300,
'h': 250
},
{
'w': 300,
'h': 600
}
],
'bids': [
{
'bidder': 'appnexus',
'params': {
'placementId': '5324321'
},
'placementCode': '/19968336/header-bid-tag-0',
'sizes': [
[
300,
250
],
[
300,
600
]
],
'bidId': '7e5d6af25ed188',
'bidderRequestId': '55e24a66bed717',
'requestId': '1ff753bd4ae5cb',
'startTime': 1463510220996,
'bid_id': '387d9d9c32ca47c'
}
]
}
],
'bids': [
{
'bidder': 'appnexus',
Expand Down Expand Up @@ -211,6 +289,84 @@ describe('adapterManager tests', () => {
'bidderRequestId': '2946b569352ef2',
'tid': '34566b569352ef2',
'src': 's2s',
'adUnitsS2SCopy': [
{
'code': '/19968336/header-bid-tag1',
'sizes': [
{
'w': 728,
'h': 90
},
{
'w': 970,
'h': 90
}
],
'bids': [
{
'bidder': 'appnexus',
'params': {
'placementId': '543221',
'test': 'me'
},
'placementCode': '/19968336/header-bid-tag1',
'sizes': [
[
728,
90
],
[
970,
90
]
],
'bidId': '68136e1c47023d',
'bidderRequestId': '55e24a66bed717',
'requestId': '1ff753bd4ae5cb',
'startTime': 1463510220995,
'status': 1,
'bid_id': '378a8914450b334'
}
]
},
{
'code': '/19968336/header-bid-tag-0',
'sizes': [
{
'w': 300,
'h': 250
},
{
'w': 300,
'h': 600
}
],
'bids': [
{
'bidder': 'appnexus',
'params': {
'placementId': '5324321'
},
'placementCode': '/19968336/header-bid-tag-0',
'sizes': [
[
300,
250
],
[
300,
600
]
],
'bidId': '7e5d6af25ed188',
'bidderRequestId': '55e24a66bed717',
'requestId': '1ff753bd4ae5cb',
'startTime': 1463510220996,
'bid_id': '387d9d9c32ca47c'
}
]
}
],
'bids': [
{
'bidder': 'appnexus',
Expand Down

0 comments on commit 8292bb1

Please sign in to comment.