mock

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackHoleSink

type BlackHoleSink struct{}

func (BlackHoleSink) Open

func (s BlackHoleSink) Open() error

func (BlackHoleSink) ProcessDictionary

func (s BlackHoleSink) ProcessDictionary(value model.Entry) error

type Config

type Config struct {
	Routes []Route `yaml:"routes,omitempty"`
}

func LoadConfigFromFile

func LoadConfigFromFile(filename string) (*Config, error)

func (*Config) Build

func (cfg *Config) Build(backend *url.URL) (Context, error)

type Context

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

func (Context) Process

func (ctx Context) Process(w http.ResponseWriter, r *http.Request) (*http.Response, error)

type ContextRoute

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

func NewContextRoute

func NewContextRoute(route Route, request, response *Processor) ContextRoute

type Masking

type Masking struct {
	Request  string `yaml:"request,omitempty"`
	Response string `yaml:"response,omitempty"`
}

type MatchResult

type MatchResult struct {
	model.Dictionary
	// contains filtered or unexported fields
}

func (*MatchResult) Build

func (mr *MatchResult) Build(new model.Dictionary) string

type Matcher

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

func NewMatcher

func NewMatcher(expr string) *Matcher

func (*Matcher) Match

func (m *Matcher) Match(path string) *MatchResult

type Processor

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

func NewProcessor

func NewProcessor(maskingFile string) (*Processor, error)

func (*Processor) Process

func (p *Processor) Process(dict model.Dictionary) error

type RequestDict

type RequestDict struct {
	model.Dictionary
}

func NewRequestDict

func NewRequestDict(request *http.Request) (RequestDict, error)

func (RequestDict) Body

func (r RequestDict) Body() string

func (RequestDict) Captures

func (r RequestDict) Captures() model.Dictionary

func (RequestDict) Method

func (r RequestDict) Method() string

func (RequestDict) Protocol

func (r RequestDict) Protocol() string

func (RequestDict) SetCaptures

func (r RequestDict) SetCaptures(captures model.Dictionary)

func (RequestDict) SetURLPath

func (r RequestDict) SetURLPath(path string)

func (RequestDict) ToRequest

func (r RequestDict) ToRequest() (*http.Request, error)

func (RequestDict) URLFragment

func (r RequestDict) URLFragment() (string, bool)

func (RequestDict) URLPath

func (r RequestDict) URLPath() string

type ResponseDict

type ResponseDict struct {
	model.Dictionary
}

func NewResponseDict

func NewResponseDict(response *http.Response) (ResponseDict, error)

func (ResponseDict) Protocol

func (r ResponseDict) Protocol() string

func (ResponseDict) Status

func (r ResponseDict) Status() int

func (ResponseDict) ToResponse

func (r ResponseDict) ToResponse() (*http.Response, error)

type Route

type Route struct {
	Method  string  `yaml:"method,omitempty"`
	Path    string  `yaml:"path"`
	Masking Masking `yaml:"masking,omitempty"`
}

Jump to

Keyboard shortcuts

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