fakeserver

package
v0.0.5-solo Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeServer

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

FakeServer allows setting up HTTP handlers for testing purposes

func NewFakeServer

func NewFakeServer(responses map[string]Payload) *FakeServer

NewFakeServer creates new instance of fake server

func (*FakeServer) AddResponse

func (s *FakeServer) AddResponse(method string, path string, requestBody map[string]interface{}, responseBody map[string]interface{}, responseCode int)

AddResponse adds a response mapping

func (*FakeServer) DisableDebug

func (s *FakeServer) DisableDebug()

DisableDebug disables debugging

func (*FakeServer) EnableDebug

func (s *FakeServer) EnableDebug()

EnableDebug enables debugging

func (*FakeServer) ServeHTTP

func (s *FakeServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface

type Payload

type Payload struct {
	RequestBody  map[string]interface{}
	ResponseBody map[string]interface{}
	ResponseCode int
}

Payload defines combination of expected request body, response body and response code

Jump to

Keyboard shortcuts

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