GithubHelp home page GithubHelp logo

miro-balaz / chrome-har Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sitespeedio/chrome-har

0.0 0.0 1.0 1.42 MB

Create HAR files from Chrome Debugging Protocol data

License: MIT License

JavaScript 99.51% Shell 0.49%

chrome-har's Introduction

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});

chrome-har's People

Contributors

juvirez avatar marty90 avatar mikedijkstra avatar mikeecb avatar soulgalore avatar tobli avatar yurynix avatar

Forkers

beatchristen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.