Skip to content

Commit

Permalink
Between multirequests (prebid#6214)
Browse files Browse the repository at this point in the history
* added multirequests

* const endpoint

Co-authored-by: Ignat Khaylov <[email protected]>
  • Loading branch information
2 people authored and stsepelin committed May 28, 2021
1 parent 5a53ddb commit 395a34d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 9 additions & 3 deletions modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getAdUnitSizes, parseSizesInput } from '../src/utils.js';
import { getRefererInfo } from '../src/refererDetection.js';

const BIDDER_CODE = 'between';
const ENDPOINT = 'https://ads.betweendigital.com/adjson?t=prebid';

export const spec = {
code: BIDDER_CODE,
Expand Down Expand Up @@ -30,7 +31,7 @@ export const spec = {

validBidRequests.forEach(i => {
let params = {
sizes: parseSizesInput(getAdUnitSizes(i)).join('%2C'),
sizes: parseSizesInput(getAdUnitSizes(i)),
jst: 'hb',
ord: Math.random() * 10000000000000000,
tz: getTz(),
Expand Down Expand Up @@ -74,9 +75,14 @@ export const spec = {
}
}

requests.push({method: 'GET', url: 'https://ads.betweendigital.com/adjson', data: params})
requests.push({data: params})
})
return requests;
return {
method: 'POST',
url: ENDPOINT,
data: JSON.stringify(requests)
}
// return requests;
},
/**
* Unpack the response from the server into a list of bids.
Expand Down
18 changes: 9 additions & 9 deletions test/spec/modules/betweenBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('betweenBidAdapterTests', function () {
sizes: [[240, 400]]
}]
let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;
expect(req_data.bidid).to.equal('bid1234');
});
it('validate itu param', function() {
Expand All @@ -37,7 +37,7 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.itu).to.equal('https://something.url');
});
Expand All @@ -55,7 +55,7 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.cur).to.equal('THX');
});
Expand All @@ -73,7 +73,7 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.subid).to.equal(1138);
});
Expand All @@ -91,7 +91,7 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.click3rd).to.equal('https://something.url');
});
Expand All @@ -111,7 +111,7 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data['pubside_macro[param]']).to.equal('%26test%3Dtset');
});
Expand All @@ -134,7 +134,7 @@ describe('betweenBidAdapterTests', function () {
}

let request = spec.buildRequests(bidRequestData, bidderRequest);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.gdprApplies).to.equal(bidderRequest.gdprConsent.gdprApplies);
expect(req_data.consentString).to.equal(bidderRequest.gdprConsent.consentString);
Expand Down Expand Up @@ -217,8 +217,8 @@ describe('betweenBidAdapterTests', function () {
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;
let req_data = JSON.parse(request.data)[0].data;

expect(req_data.sizes).to.deep.equal('970x250%2C240x400%2C728x90');
expect(req_data.sizes).to.deep.equal(['970x250', '240x400', '728x90'])
});
});

0 comments on commit 395a34d

Please sign in to comment.