Code Monkey home page Code Monkey logo

harsharp's Introduction

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.

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.