replay

package
v0.0.0-...-7d3d334 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	ErrorHandler func(rw http.ResponseWriter, req *http.Request, err error)
	// contains filtered or unexported fields
}

Middleware allows us to wrap http.Handler to be retried this is useful for building robust proxies

func NewMiddleware

func NewMiddleware(retries int, period time.Duration, handler http.Handler) *Middleware

NewMiddleware

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Play

type Play struct {
	Bytes  int
	Writes int
	Status int
	Time   time.Duration
	// contains filtered or unexported fields
}

Represents one request try

func (*Play) Finished

func (p *Play) Finished() bool

func (*Play) Start

func (p *Play) Start()

func (*Play) Stop

func (p *Play) Stop()

type Replayer

type Replayer struct {
	Errors chan error

	// Current play record
	Play Play
	// contains filtered or unexported fields
}

Replayer provides us with a mechanism to replay HTTP requests

func NewReplayer

func NewReplayer(req *http.Request, w http.ResponseWriter) (*Replayer, error)

func (*Replayer) GetError

func (r *Replayer) GetError() error

func (*Replayer) Header

func (r *Replayer) Header() http.Header

func (*Replayer) IsFailed

func (r *Replayer) IsFailed() bool

func (*Replayer) Replay

func (r *Replayer) Replay() (*http.Request, error)

func (*Replayer) Stop

func (r *Replayer) Stop()

Reset the Replayer's state so it's ready to be replayed

func (*Replayer) Write

func (r *Replayer) Write(data []byte) (int, error)

func (*Replayer) WriteHeader

func (r *Replayer) WriteHeader(status int)

type Target

type Target struct {
	Method string
	URL    string
	Body   []byte
	Header http.Header
}

Target is a HTTP request blueprint

func NewTarget

func NewTarget(req *http.Request) (*Target, error)

func (*Target) Request

func (t *Target) Request() (*http.Request, error)

Request creates an *http.Request out of Target and returns it along with an error in case of failure.

Jump to

Keyboard shortcuts

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