httptracer

package
v0.0.0-...-373b593 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPTracer

type HTTPTracer interface {
	Request(req *http.Request) error
	Response(res *http.Response) error
}

HTTPTracer provides callback hook mechanism for HTTP transport.

type RoundTripTrace

type RoundTripTrace struct {
	Trace     HTTPTracer        // User provides callback methods
	Transport http.RoundTripper // HTTP transport that needs to be intercepted
}

RoundTripTrace interposes HTTP transport requests and respsonses using HTTPTracer hooks

func GetNewTraceTransport

func GetNewTraceTransport(trace HTTPTracer, transport http.RoundTripper) RoundTripTrace

GetNewTraceTransport returns a traceable transport

Takes first argument a custom tracer which implements Response, Request() conforming to HTTPTracer interface. Another argument can be a default transport or a custom http.RoundTripper implementation

func (RoundTripTrace) CancelRequest

func (t RoundTripTrace) CancelRequest(req *http.Request)

CancelRequest implements functinality to cancel an underlying request.

func (RoundTripTrace) RoundTrip

func (t RoundTripTrace) RoundTrip(req *http.Request) (res *http.Response, err error)

RoundTrip executes user provided request and response hooks for each HTTP call.

Jump to

Keyboard shortcuts

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