request

package
v0.0.0-...-a5469ec Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2015 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Overview

Wrapper around http.Request with additional features

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt interface {
	GetError() error
	GetDuration() time.Duration
	GetResponse() *http.Response
	GetEndpoint() endpoint.Endpoint
}

type BaseAttempt

type BaseAttempt struct {
	Error    error
	Duration time.Duration
	Response *http.Response
	Endpoint endpoint.Endpoint
}

func (*BaseAttempt) GetDuration

func (ba *BaseAttempt) GetDuration() time.Duration

func (*BaseAttempt) GetEndpoint

func (ba *BaseAttempt) GetEndpoint() endpoint.Endpoint

func (*BaseAttempt) GetError

func (ba *BaseAttempt) GetError() error

func (*BaseAttempt) GetResponse

func (ba *BaseAttempt) GetResponse() *http.Response

type BaseRequest

type BaseRequest struct {
	HttpRequest *http.Request
	Id          int64
	Body        netutils.MultiReader
	Attempts    []Attempt
	// contains filtered or unexported fields
}

func NewBaseRequest

func NewBaseRequest(r *http.Request, id int64, body netutils.MultiReader) *BaseRequest

func (*BaseRequest) AddAttempt

func (br *BaseRequest) AddAttempt(a Attempt)

func (*BaseRequest) DeleteUserData

func (br *BaseRequest) DeleteUserData(key string)

func (*BaseRequest) GetAttempts

func (br *BaseRequest) GetAttempts() []Attempt

func (*BaseRequest) GetBody

func (br *BaseRequest) GetBody() netutils.MultiReader

func (*BaseRequest) GetHttpRequest

func (br *BaseRequest) GetHttpRequest() *http.Request

func (*BaseRequest) GetId

func (br *BaseRequest) GetId() int64

func (*BaseRequest) GetLastAttempt

func (br *BaseRequest) GetLastAttempt() Attempt

func (*BaseRequest) GetUserData

func (br *BaseRequest) GetUserData(key string) (i interface{}, b bool)

func (*BaseRequest) SetBody

func (br *BaseRequest) SetBody(b netutils.MultiReader)

func (*BaseRequest) SetHttpRequest

func (br *BaseRequest) SetHttpRequest(r *http.Request)

func (*BaseRequest) SetUserData

func (br *BaseRequest) SetUserData(key string, baton interface{})

func (*BaseRequest) String

func (br *BaseRequest) String() string

type Request

type Request interface {
	GetHttpRequest() *http.Request              // Original http request
	SetHttpRequest(*http.Request)               // Can be used to set http request
	GetId() int64                               // Request id that is unique to this running process
	SetBody(netutils.MultiReader)               // Sets request body
	GetBody() netutils.MultiReader              // Request body fully read and stored in effective manner (buffered to disk for large requests)
	AddAttempt(Attempt)                         // Add last proxy attempt to the request
	GetAttempts() []Attempt                     // Returns last attempts to proxy request, may be nil if there are no attempts
	GetLastAttempt() Attempt                    // Convenience method returning the last attempt, may be nil if there are no attempts
	String() string                             // Debugging string representation of the request
	SetUserData(key string, baton interface{})  // Provide storage space for data that survives with the request
	GetUserData(key string) (interface{}, bool) // Fetch user data set from previously SetUserData call
	DeleteUserData(key string)                  // Clean up user data set from previously SetUserData call
}

Request is a rapper around http request that provides more info about http.Request

Jump to

Keyboard shortcuts

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