Skip to content

Commit

Permalink
fix failing test and remove redundant "&" in URL
Browse files Browse the repository at this point in the history
  • Loading branch information
arikkfir committed May 25, 2018
1 parent 9a71939 commit f7bf27d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/gambidBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const spec = {
return validBidRequests.map(bidRequest => {
const { adUnitCode, auctionId, mediaTypes, params, sizes, transactionId } = bidRequest;
const baseEndpoint = params[ 'rtbEndpoint' ] || 'https://rtb.gambid.io';
const rtbEndpoint = `${baseEndpoint}/r/${params.supplyPartnerId}/bidr?rformat=open_rtb&bidder=prebid&` + params.query || '';
const rtbEndpoint = `${baseEndpoint}/r/${params.supplyPartnerId}/bidr?rformat=open_rtb&bidder=prebid` + (params.query ? '&' + params.query : '');
const rtbBidRequest = {
'id': auctionId,
'site': {
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/gambidBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ describe('GambidAdapter', () => {

response = spec.buildRequests([ bidRequest ])[ 0 ];
expect(response.method).to.equal('POST');
expect(response.url).to.match(new RegExp(`^https://rtb\\.gambid\\.io/r/${supplyPartnerId}/bidr\\?bidder=prebid&_cb=\\d+$`, 'g'));
expect(response.url).to.match(new RegExp(`^https://rtb\\.gambid\\.io/r/${supplyPartnerId}/bidr\\?rformat=open_rtb&bidder=prebid$`, 'g'));
expect(response.data.id).to.equal(bidRequest.auctionId);

const bidRequestWithEndpoint = deepClone(bidRequest);
bidRequestWithEndpoint.params.rtbEndpoint = 'https://rtb2.gambid.io/a12';
response = spec.buildRequests([ bidRequestWithEndpoint ])[ 0 ];
expect(response.url).to.match(new RegExp(`^https://rtb2\\.gambid\\.io/a12/r/${supplyPartnerId}/bidr\\?bidder=prebid&_cb=\\d+$`, 'g'));
expect(response.url).to.match(new RegExp(`^https://rtb2\\.gambid\\.io/a12/r/${supplyPartnerId}/bidr\\?rformat=open_rtb&bidder=prebid$`, 'g'));
});

it('builds request correctly', () => {
Expand Down

0 comments on commit f7bf27d

Please sign in to comment.