Skip to content
A small and easy-to-use library to parse HTTP Archive (HAR) format to .NET objects.
C# PowerShell Batchfile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
appveyor.yml
build.cake
build.ps1
buildNuget.cmd
global.json

README.md

HarSharp

Build status Quality status Coverage Status License Nuget

A small and easy-to-use library to parse HTTP Archive (HAR) format to .NET objects.


Introduction

The HTTP Archive (HAR) format as defined in the W3C Specification is an archival format for HTTP transactions that can be used by a web browser to export detailed performance data about web pages it loads.

So, every modern browser nowadays can export HAR with a lot of information about the user navigation. Chrome, for example, can export HAR from Developer Tools, Network tab, right mouse click and "Copy all as HAR".

What I can do with HAR data? Well, there a lot of things I can imagine right now, like:

  • Web performance tests runners
  • Performance analyzers
  • Navigation visualizers

Setup

NuGet

install-package HarSharp

Usage

Deserialize from string

var har = HarConvert.Deserialize(harContent);

Deserialize from file

var har = HarConvert.DeserializeFromFile(fileName);

Listing pages load time

var har = HarConvert.Deserialize(harContent);

foreach(var page in har.Log.Pages)
{
	Console.WriteLine(
	"Page: {0} loaded in {1} milliseconds", 
	page.Title, 
	page.PageTimings.OnLoad);
}

Code philosophy

The idea of HarSharp is simplify and promote the use of HAR in .NET codes and keep closest possible to W3C specification , for this reason the below rules were followed during the library development:

  • Keep the entities and properties names equals to the one defined in the specification, but follow the C# naming guidelines, so, "pages" became "Pages".
  • Keep the properties types closest to the spec, but change when there is a better type on .NET side.
    • string (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD): System.DateTime (UTC).
    • string (url): System.Uri.
  • Full documentation using citations from W3C specification.
  • StyleCop validation.
  • FxCop Validation.
  • 100% unit test coverage

FAQ

Having troubles?

Roadmap

  • Serialize HAR entities back to HAR file.

How to improve it?

License

Licensed under the The MIT License (MIT). In others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.

You can’t perform that action at this time.