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

Option to disable including content in the HAR? #4

Open
soulgalore opened this issue Feb 21, 2018 · 2 comments
Open

Option to disable including content in the HAR? #4

soulgalore opened this issue Feb 21, 2018 · 2 comments
Assignees

Comments

@soulgalore
Copy link
Contributor

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

@janodvarko
Copy link
Member

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

@janodvarko janodvarko self-assigned this Feb 27, 2018
@soulgalore
Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants