httptrace

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPTrace

type HTTPTrace interface {
	SetPhase(message string)
	SendRequest(method, url string)
	// return a reader of the body content if the body is consumed; otherwise, return nil
	GotResponse(statusCode int, status string, header http.Header, body io.ReadCloser) io.Reader
	GotError(message string)
	AddComment(step, comment string)
}

type NopTracer

type NopTracer struct {
}

func (NopTracer) AddComment

func (t NopTracer) AddComment(step, message string)

func (NopTracer) GotError

func (t NopTracer) GotError(message string)

func (NopTracer) GotResponse

func (t NopTracer) GotResponse(statusCode int, status string, header http.Header, body io.ReadCloser) io.Reader

func (NopTracer) SendRequest

func (t NopTracer) SendRequest(method, url string)

func (NopTracer) SetPhase

func (t NopTracer) SetPhase(message string)

type TraceClient

type TraceClient struct {
	Trace  HTTPTrace
	Client *http.Client
}

func (TraceClient) Do

func (tc TraceClient) Do(req *http.Request) (*http.Response, error)

func (TraceClient) Get

func (tc TraceClient) Get(url string) (*http.Response, error)

func (TraceClient) Head

func (tc TraceClient) Head(url string) (*http.Response, error)

func (TraceClient) Post

func (tc TraceClient) Post(url, contentType string, body io.Reader) (*http.Response, error)

func (TraceClient) SetTimeout

func (tc TraceClient) SetTimeout(timeout time.Duration)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL