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

Between multirequests #6214

Merged
merged 3 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 8 additions & 3 deletions modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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 +74,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: 'https://ads.betweendigital.com/adjson?t=prebid',
Copy link

Choose a reason for hiding this comment

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

Just a suggestion, but might be a good idea to set this as a const at the top of your adapter? Like STR_ENDPOINT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree too. I have made a fix in a commit

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'])
});
});