diff --git a/modules/mgidXBidAdapter.js b/modules/mgidXBidAdapter.js index 7e084977cf1..ac25a419de1 100644 --- a/modules/mgidXBidAdapter.js +++ b/modules/mgidXBidAdapter.js @@ -17,7 +17,7 @@ import { USERSYNC_DEFAULT_CONFIG } from '../src/userSync.js'; const BIDDER_CODE = 'mgidX'; const GVLID = 358; -const AD_URL = 'https://us-east-x.mgid.com/pbjs'; +const AD_URL = 'https://#{REGION}#.mgid.com/pbjs'; const PIXEL_SYNC_URL = 'https://cm.mgid.com/i.gif'; const IFRAME_SYNC_URL = 'https://cm.mgid.com/i.html'; @@ -181,9 +181,18 @@ export const spec = { placements.push(getPlacementReqData(bid)); } + const region = validBidRequests[0].params?.region; + + let url; + if (region === 'eu') { + url = AD_URL.replace('#{REGION}#', 'eu'); + } else { + url = AD_URL.replace('#{REGION}#', 'us-east-x'); + } + return { method: 'POST', - url: AD_URL, + url: url, data: request }; }, diff --git a/test/spec/modules/mgidXBidAdapter_spec.js b/test/spec/modules/mgidXBidAdapter_spec.js index 978ca3de036..e0b1e1a84e9 100644 --- a/test/spec/modules/mgidXBidAdapter_spec.js +++ b/test/spec/modules/mgidXBidAdapter_spec.js @@ -6,7 +6,6 @@ import { config } from '../../../src/config'; import { USERSYNC_DEFAULT_CONFIG } from '../../../src/userSync'; const bidder = 'mgidX' -const adUrl = 'https://us-east-x.mgid.com/pbjs'; describe('MGIDXBidAdapter', function () { const bids = [ @@ -19,6 +18,7 @@ describe('MGIDXBidAdapter', function () { } }, params: { + region: 'eu', placementId: 'testBanner', } }, @@ -56,6 +56,7 @@ describe('MGIDXBidAdapter', function () { } }, params: { + region: 'eu', placementId: 'testNative', } } @@ -108,8 +109,16 @@ describe('MGIDXBidAdapter', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', function () { - expect(serverRequest.url).to.equal(adUrl); + it('Returns valid EU URL', function () { + bids[0].params.region = 'eu'; + serverRequest = spec.buildRequests(bids, bidderRequest); + expect(serverRequest.url).to.equal('https://eu.mgid.com/pbjs'); + }); + + it('Returns valid EAST URL', function () { + bids[0].params.region = 'other'; + serverRequest = spec.buildRequests(bids, bidderRequest); + expect(serverRequest.url).to.equal('https://us-east-x.mgid.com/pbjs'); }); it('Returns general data valid', function () { @@ -193,12 +202,6 @@ describe('MGIDXBidAdapter', function () { expect(data.ccpa).to.equal(bidderRequest.uspConsent); expect(data.gdpr).to.not.exist; }); - - it('Returns empty data if no valid requests are passed', function () { - serverRequest = spec.buildRequests([], bidderRequest); - let data = serverRequest.data; - expect(data.placements).to.be.an('array').that.is.empty; - }); }); describe('interpretResponse', function () {