Socket
Socket
Sign inDemoInstall

chrome-har

Package Overview
Dependencies
11
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chrome-har

Create HAR files from Chrome Debugging Protocol data.


Version published
Weekly downloads
44K
increased by2.5%
Maintainers
3
Created
Weekly downloads
 

Changelog

Source

0.13.2 - 2023-07-30

Fixed

  • Updated tough-cookie, thank you lallenlowe for PR #107.

Readme

Source

Chrome-har

Unit tests

Create HAR files based on Chrome DevTools Protocol data.

Code originally extracted from Browsertime, initial implementation inspired by Chromedriver_har.

Create a new bug report

Make sure to generate a event trace log file that we can use to recreate your issue. If you use Browsertime you can enable the trace with --chrome.collectPerfLog:

$ browsertime --chrome.collectPerfLog -n 1 https://www.sitespeed.io

Then take the file named chromePerflog-1.json.gz and put it in a gist or make it availible to us in any way you want.

If you use sitespeed.io:

$ sitespeed.io --browsertime.chrome.collectPerfLog -n 1 https://www.sitespeed.io

Support for Response Bodies

If you use Chrome-har standalone (without Browsertime/sitespeed.io) you can use get the response bodies in HARs if they are set on the response object by the caller and if the includeTextFromResponseBody option is set to true.

For example:

const harEvents: Array<any> = [];

client.on('Network.requestIntercepted', async (params: any) => {
  // Get the response body
  const response = await client.send(
    'Network.getResponseBodyForInterception',
    { interceptionId: params.interceptionId },
  );

  // Set the body on the response object
  if (params.response != null) {
    params.response.body = response.body;
  } else {
    params.response = response;
  }

  // Continue the request
  await client.send(
    'Network.continueInterceptedRequest',
    { interceptionId: params.interceptionId },
  );

  harEvents.push({ method, params });
});

const har = harFromMessages(harEvents, {includeTextFromResponseBody: true});

Keywords

FAQs

Last updated on 30 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc