mock

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mock implements a mock HTTP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMock

type HTTPMock struct {
	// contains filtered or unexported fields
}

HTTPMock is supposed to be used to mock real HTTP server but have the ability to test all other httpmux plugin related code

Example:

   httpmux.FromExistingServer(mock.SetHandler)
	  mock.NewRequest("GET", "/v1/a", nil)

func (*HTTPMock) NewRequest

func (mock *HTTPMock) NewRequest(method, url string, body io.Reader) (*http.Response, error)

NewRequest propagates the request to the httpmux

func (*HTTPMock) SetHandler

func (mock *HTTPMock) SetHandler(config rest.Config, handler http.Handler) (httpServer io.Closer, err error)

SetHandler is called from httpmux plugin during startup (handler is usually the gorilla mux instance)

Jump to

Keyboard shortcuts

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