The CMCD data to be transformed into a report
The target configuration for the CMCD report
A CMCD report object
const data = {
br: 1000,
'com.example-hello': 'world',
ec: ['ERR001', 'ERR002'],
su: true,
ts: 0,
}
const headerRequestReport = toCmcdReport(data, {
url: 'https://hello.world/',
version: 2,
method: 'POST',
reportingMode: CmcdReportingMode.REQUEST,
transmissionMode: CmcdTransmissionMode.HEADERS,
})
deepEqual(headerRequestReport, {
url: 'https://hello.world/',
method: 'POST',
headers: {
'CMCD-Object': 'br=1000',
'CMCD-Request': 'com.example-hello="world",su,ts=0',
'CMCD-Session': 'v=2',
'CMCD-Status': 'ec=("ERR001" "ERR002")',
},
})
Converts CMCD data into a report format.