diff --git a/modules/consentManagementGpp.js b/modules/consentManagementGpp.js index 69fc5789953..8160ee2378c 100644 --- a/modules/consentManagementGpp.js +++ b/modules/consentManagementGpp.js @@ -247,7 +247,7 @@ class GPP10Client extends GPPClient { getGPPData(pingData) { const parsedSections = GreedyPromise.all( - pingData.supportedAPIs.map((api) => this.cmp({ + (pingData.supportedAPIs || pingData.apiSupport || []).map((api) => this.cmp({ command: 'getSection', parameter: api }).catch(err => { diff --git a/test/spec/modules/consentManagementGpp_spec.js b/test/spec/modules/consentManagementGpp_spec.js index e15ce30940c..99d4f94f502 100644 --- a/test/spec/modules/consentManagementGpp_spec.js +++ b/test/spec/modules/consentManagementGpp_spec.js @@ -572,6 +572,17 @@ describe('consentManagementGpp', function () { expect(err.message).to.eql('err'); done(); }); + }); + + it('should not choke if supportedAPIs is missing', () => { + [gppData, pingData].forEach(ob => { delete ob.supportedAPIs; }) + mockCmpCommands({ + getGPPData: () => gppData + }); + return gppClient.getGPPData(pingData).then(res => { + expect(res.gppString).to.eql(gppData.gppString); + expect(res.parsedSections).to.eql({}); + }) }) describe('section data', () => {