Documentation ¶
Index ¶
- func DefaultHandler(w http.ResponseWriter, r *http.Request)
- func GetRequestTestHandler(t testing.TB, expectationStore ExpectationStore, handler http.HandlerFunc) http.HandlerFunc
- func NewURL(scheme, host, path string) *url.URL
- func SetupHTTPCallHeavyweight(t testing.TB, expectationStore ExpectationStore, handlerFunc http.HandlerFunc, ...)
- func StartServer(t testing.TB, expectations ExpectationStore)
- func ValidateHTTPResponseAndErr(t *testing.T, response *http.Response, err error)
- type ExpectationList
- type ExpectationStore
- type HTTPRequestExpectations
- type HTTPResponseExpectations
- type HandlerTransport
- type PipeResponseWriter
- type RewriteTransport
- type SimulatedRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHandler ¶
func DefaultHandler(w http.ResponseWriter, r *http.Request)
func GetRequestTestHandler ¶
func GetRequestTestHandler(t testing.TB, expectationStore ExpectationStore, handler http.HandlerFunc) http.HandlerFunc
func SetupHTTPCallHeavyweight ¶
func SetupHTTPCallHeavyweight(t testing.TB, expectationStore ExpectationStore, handlerFunc http.HandlerFunc, roundTripper http.RoundTripper)
func StartServer ¶
func StartServer(t testing.TB, expectations ExpectationStore)
Types ¶
type ExpectationList ¶
type ExpectationList struct { Pos int Ex []HTTPRequestExpectations // contains filtered or unexported fields }
type ExpectationStore ¶
type ExpectationStore map[string]*ExpectationList
func NewExpectationStore ¶
func NewExpectationStore(tokenCalls int) ExpectationStore
func NewExpectationStoreNoToken ¶
func NewExpectationStoreNoToken() ExpectationStore
func (ExpectationStore) Get ¶
func (ex ExpectationStore) Get(k string) (HTTPRequestExpectations, bool)
func (ExpectationStore) HasKey ¶
func (ex ExpectationStore) HasKey(k string) bool
func (ExpectationStore) Keys ¶
func (ex ExpectationStore) Keys() []string
func (ExpectationStore) Put ¶
func (ex ExpectationStore) Put(k string, v HTTPRequestExpectations)
type HTTPRequestExpectations ¶
type HTTPRequestExpectations struct { Body io.ReadCloser Header http.Header Method string URL *url.URL Host string ResponseExpectations HTTPResponseExpectations }
type HandlerTransport ¶
type HandlerTransport struct { Handler http.Handler ResponseTransformer func(response *http.Response) *http.Response }
func NewHandlerTransport ¶
type PipeResponseWriter ¶
type PipeResponseWriter struct {
// contains filtered or unexported fields
}
func (*PipeResponseWriter) Header ¶
func (w *PipeResponseWriter) Header() http.Header
func (*PipeResponseWriter) WriteHeader ¶
func (w *PipeResponseWriter) WriteHeader(status int)
type RewriteTransport ¶
type RewriteTransport struct { Transport http.RoundTripper URL *url.URL }
RewriteTransport is an http.RoundTripper that rewrites requests using the provided URL's Scheme and Host, and its Path as a prefix. The Opaque field is untouched. If Transport is nil, http.DefaultTransport is used.
func NewRewriteTransport ¶
func NewRewriteTransport(transport http.RoundTripper, url *url.URL) RewriteTransport
type SimulatedRoundTripper ¶
type SimulatedRoundTripper struct { T testing.TB Expectations ExpectationStore RoundTripper func(*http.Request) (*http.Response, error) Strict bool }
func NewSimulatedRoundTripper ¶
func NewSimulatedRoundTripper(t testing.TB, expectations ExpectationStore, roundTripper func(*http.Request) (*http.Response, error), strict bool) SimulatedRoundTripper
Click to show internal directories.
Click to hide internal directories.