From 62907bd6420f019a4548ad1294baff8f37613d71 Mon Sep 17 00:00:00 2001 From: Ignat Khaylov Date: Wed, 27 Jan 2021 17:53:20 +0300 Subject: [PATCH] Between multirequests (#6214) * added multirequests * const endpoint Co-authored-by: Ignat Khaylov --- modules/betweenBidAdapter.js | 12 +++++++++--- test/spec/modules/betweenBidAdapter_spec.js | 18 +++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/betweenBidAdapter.js b/modules/betweenBidAdapter.js index 0ed05717391..f445c9dfd5d 100644 --- a/modules/betweenBidAdapter.js +++ b/modules/betweenBidAdapter.js @@ -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, @@ -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(), @@ -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. diff --git a/test/spec/modules/betweenBidAdapter_spec.js b/test/spec/modules/betweenBidAdapter_spec.js index 94db41ba014..44a8d2cc733 100644 --- a/test/spec/modules/betweenBidAdapter_spec.js +++ b/test/spec/modules/betweenBidAdapter_spec.js @@ -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() { @@ -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'); }); @@ -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'); }); @@ -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); }); @@ -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'); }); @@ -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'); }); @@ -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); @@ -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']) }); });