Skip to content
net/http client logging by HAR format
Go Shell
Branch: master
Clone or download
Latest commit b745198 Oct 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci add Circle CI settings Oct 1, 2019
internal/cmd/harlogtest
.gitignore add Circle CI settings Oct 1, 2019
LICENSE Initial commit Oct 1, 2019
README.md update README.md Oct 3, 2019
client_tracer.go add codes from vvakame/til#42 Oct 1, 2019
go.mod add Circle CI settings Oct 1, 2019
go.sum add Circle CI settings Oct 1, 2019
round_tripper.go implement UnmarshalJSON to Time & Duration Oct 3, 2019
setup.sh add Circle CI settings Oct 1, 2019
test.sh add Circle CI settings Oct 1, 2019
tools.go add Circle CI settings Oct 1, 2019
types.go implement UnmarshalJSON to Time & Duration Oct 3, 2019
types_test.go implement UnmarshalJSON to Time & Duration Oct 3, 2019

README.md

go-harlog Go Documentation CircleCI

net/http client logging by HAR format.

Take http request/response log by HAR (HTTP Archive) format. It can visualize by any tools.

How to use

$ go get github.com/vvakame/go-harlog
har := &harlog.Transport{}
hc := &http.Client{
    Transport: har,
}

// do something...

b, err := json.MarshalIndent(har.HAR(), "", "  ")
if err != nil {
    return err
}
fmt.Println(string(b))

See HAR file in Google Chrome DevTools.

This screenshots are generated by this library. Capture the log about Google Cloud Storage access by cloud.google.com/go/storage.

Headers

Response

Timing

Limitations

  • compressed response is not supported yet.
  • headersSize is not calculated.

patches welcome!

You can’t perform that action at this time.