MCPcopy Index your code
hub / github.com/bracesdev/errtrace / Example_http

Function Example_http

example_http_test.go:14–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12)
13
14func Example_http() {
15 tp := &http.Transport{Dial: rateLimitDialer}
16 client := &http.Client{Transport: tp}
17 ps := &PackageStore{
18 client: client,
19 }
20
21 _, err := ps.Get()
22 fmt.Printf("Error fetching packages: %+v\n", tracetest.MustClean(errtrace.FormatString(err)))
23 // Output:
24 // Error fetching packages: Get "http://example.com/packages.index": connect rate limited
25 //
26 // braces.dev/errtrace_test.rateLimitDialer
27 // /path/to/errtrace/example_http_test.go:3
28 // braces.dev/errtrace_test.(*PackageStore).updateIndex
29 // /path/to/errtrace/example_http_test.go:2
30 // braces.dev/errtrace_test.(*PackageStore).Get
31 // /path/to/errtrace/example_http_test.go:1
32}
33
34type PackageStore struct {
35 client *http.Client

Callers

nothing calls this directly

Calls 3

GetMethod · 0.95
MustCleanFunction · 0.92
FormatStringFunction · 0.92

Tested by

no test coverage detected