mockserver

package
v0.0.0-...-4bbce29 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MonoModelDesc

type MonoModelDesc struct {
	APIPath    string
	APIVersion string
	Operation  string
	SelIndex   int
}

MonoModelDesc specifies a monomorphiszed API model. It is mainly used to determine the API invocation sequence of one execution.

type Option

type Option struct {
	Addr    string
	Port    int
	Index   string
	SpecDir string
	Timeout time.Duration
}

type Override

type Override struct {
	PathPattern regexp.Regexp

	RequestModify *swagger.RequestDescriptor

	ResponseSelectorMerge string
	ResponseSelectorJSON  string

	ResponseBody       string
	ResponsePatchMerge string
	ResponsePatchJSON  string

	ResponseHeader     map[string]string
	ResponseStatusCode int

	SynthOption    *swagger.SynthesizerOption
	ExpanderOption *swagger.ExpanderOption
}

type Overrides

type Overrides []Override

func (Overrides) Match

func (ovs Overrides) Match(path string) *Override

type Server

type Server struct {
	Addr string
	Port int

	Idx     azidx.Index
	Specdir string
	// contains filtered or unexported fields
}

func New

func New(opt Option) (*Server, error)

New creates a new (uninitialized) mockserver, which can be started, but needs to be initiated in order to work as expected.

func (*Server) Handle

func (srv *Server) Handle(w http.ResponseWriter, r *http.Request)

func (*Server) InitExecution

func (srv *Server) InitExecution(ov []Override)

InitExecution initiates for each execution, for resetting the overrides and the rnd.

func (*Server) InitVibration

func (srv *Server) InitVibration(vibrate *Vibration)

func (*Server) Records

func (srv *Server) Records() []swagger.JSONValue

func (*Server) Sequences

func (srv *Server) Sequences() []MonoModelDesc

func (*Server) Start

func (srv *Server) Start() error

func (*Server) Stop

func (srv *Server) Stop(ctx context.Context) error

func (*Server) VibrationRecord

func (srv *Server) VibrationRecord() *swagger.JSONValue

type Vibration

type Vibration struct {
	PathPattern regexp.Regexp
	Path        string
	Value       interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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