Skip to content

Commit

Permalink
consentManagementGpp: do not require supportedAPIs from CMP (#10470)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed Sep 11, 2023
1 parent ff91af1 commit 914cf6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/consentManagementGpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
11 changes: 11 additions & 0 deletions test/spec/modules/consentManagementGpp_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 914cf6d

Please sign in to comment.