har – zgo.at/har Index | Files | Directories

package har

import "zgo.at/har"

Index

Types

type Entry

type Entry struct {
	PageRef         string    `json:"pageRef"` // "page_1"
	StartedDateTime time.Time `json:"startedDateTime"`

	Request struct {
		BodySize    int    `json:"bodySize"`
		HeadersSize int    `json:"headersSize"`
		Method      string `json:"method"`
		URL         string `json:"url"`         // "http://localhost/..."
		HTTPVersion string `json:"httpVersion"` // "HTTP/1.1"
		Headers     []struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"headers"`
		Cookies []struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"headers"`
		QueryString []struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"queryString"`
	} `json:"request"`

	Response struct {
		HeadersSize int    `json:"headersSize"`
		BodySize    int    `json:"bodySize"`
		Status      int    `json:"status"`
		StatusText  string `json:"statusText"`  // "OK"
		HTTPVersion string `json:"httpVersion"` // "HTTP/1.1"
		RedirectURL string `json:"redirectURL"`
		Headers     []struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"headers"`
		Cookies []struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"headers"`
		Content struct {
			Encoding string `json:"encoding"`
			Size     int    `json:"size"`
			Text     string `json:"text"`
		} `json:"content"`
	} `json:"response"`

	Cache struct {
	} `json:"cache"`

	Timings struct {
		Blocked int `json:"blocked"`
		DNS     int `json:"dns"`
		Connect int `json:"connect"`
		SSL     int `json:"ssl"`
		Send    int `json:"send"`
		Wait    int `json:"wait"`
		Receive int `json:"receive"`
	} `json:"timings"`

	Time            int    `json:"time"`
	SecurityState   string `json:"_securityState"`  // TODO
	ServerIPAddress string `json:"serverIPAddress"` // "::1"
	Connection      string `json:"connection"`      // "80"
}

type Har

type Har struct {
	File string `json:"-"` // File this was read from.

	Log struct {
		Version string `json:"version"` // "1.2"
		Creator struct {
			Name    string `json:"name"`    // "Firefox"
			Version string `json:"version"` // "72.0.2"
		} `json:"creator"`
		Browser struct {
			Name    string `json:"name"`    // "Firefox"
			Version string `json:"version"` // "72.0.2"
		} `json:"browser"`
		Pages []struct {
			StartedDateTime time.Time `json:"startedDateTime"`
			ID              string    `json:"id"` // "page_1"
			PageTimings     struct {
				OnContentLoad int `json:"onContentLoad"`
				OnLoad        int `json:"onLoad"`
			} `json:"pageTimings"`
		} `json:"pages"`

		Entries []Entry `json:"entries"`
	} `json:"log"`
}

Har archive.

func FromFile

func FromFile(f string) (*Har, error)

FromFile reads a file in to a Har struct.

func (*Har) Extract

func (h *Har) Extract(verbose bool) error

Extract all the files.

Source Files

har.go

Directories

PathSynopsis
cmd
cmd/unhar
Version
v0.0.0-20211017234821-5c4e76173225 (latest)
Published
Oct 17, 2021
Platform
linux/amd64
Imports
8 packages
Last checked
1 month ago

Tools for package owners.