har-export-trigger
har-export-trigger copied to clipboard
Option to disable including content in the HAR?
Hi, one good feature in the future would be to disable getting the content inside of the HAR. Right now it includes everything in the content fields (that's great for debugging) but if it is possible to disable that from a config that would be great (it will make the HAR files so much smaller). Best Peter
Yes, agree. The problem is that chrome.devtools.network.getHAR()
method (as designed by chrome does always return the response body. There is no option to exclude it (and e.g. improve performance).
So, this extension can make sure that the response body is not in the result log (if some flag says so) by doing something like:
log.entries.forEach(entry => {
delete entry.response.content.text;
})
It would look like as follows from the client perspective:
var options = {
responseBody: false, // Do not include response bodies
};
HAR.triggerExport(options).then(har => {
// length should be smaller if response bodies are not included
var length = JSON.stringify(har.log).length;
var size = getFormattedSize(length);
console.log("HAR log (" + size + ") ", har.log);
});
Would that help? Honza
I don't maybe it doesn't matter if the API always includes? I manually wash it now depending on flags, and I think it's overkill then to include it the trigger?