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

consentManagementGpp: do not require supportedAPIs from CMP #10470

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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