mock

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMockedRoutes

func MakeMockedRoutes(router *mux.Router, logger contracts.Logger, mocks []Mock)

Types

type Handler

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

func NewMockHandler

func NewMockHandler(options ...HandlerOption) *Handler

func (*Handler) ServeHTTP

func (handler *Handler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type HandlerOption

type HandlerOption = func(*Handler)

func WithLogger added in v0.0.7

func WithLogger(logger contracts.Logger) HandlerOption

func WithResponse added in v0.0.7

func WithResponse(response Response) HandlerOption

type Mock

type Mock struct {
	Path     string            `yaml:"path"`
	Method   string            `yaml:"method"`
	Queries  map[string]string `yaml:"queries"`
	Headers  map[string]string `yaml:"headers"`
	Response Response          `yaml:"response"`
}

type Response

type Response struct {
	Code       int               `yaml:"code"`
	Headers    map[string]string `yaml:"headers"`
	RawContent string            `yaml:"raw-content"` //nolint:tagliatelle
}

Jump to

Keyboard shortcuts

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