har-export-trigger
har-export-trigger copied to clipboard
Resulting HAR does not conform to spec
The HAR returned by v0.6.1 of the plugin on FF v68 does not conform to v1.2 of the HAR spec.
I've noticed two issues that cause the return value of HAR.triggerExport() to fail validation:
- As mentioned it #14 it does not have
logas the root key, and - Pages do not include a
titlekey
The Apache 2 Licensed Browsertime project includes a function which brings the plugin return value into conformity, partially reproduced here:
HAR.triggerExport()
.then((result) => {
// Different handling in FF 60 and 61 :|
if (result.log) {
result.log.pages[0].title = document.URL;
}
else {
result.pages[0].title = document.URL;
}
// Normalize
return callback({'har': result.log ? result: {log: result}});
})