mckmaps

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdTypeReturns   = CmdType(mapPolicyReturns)
	CmdTypeForwards  = CmdType(mapPolicyForwards)
	CmdTypeRedirects = CmdType(mapPolicyRedirects)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSOptions added in v1.1.9

type CORSOptions struct {
	Enabled          bool
	AllowCredentials bool
	MaxAge           int64
	AllowedOrigins   []string
	AllowedMethods   []myhttp.HTTPMethod
	AllowedHeaders   []string
	ExposedHeaders   []string
}

func (*CORSOptions) ToCors added in v1.1.9

func (c *CORSOptions) ToCors() *cors.Cors

type CmdType added in v1.1.7

type CmdType string

type Config added in v1.1.9

type Config struct {
	CORS               *CORSOptions
	MatchTrailingSlash bool
}

type Forwards added in v1.1.7

type Forwards struct {
	Path    string
	Latency *Interval
}

type Interval added in v1.1.3

type Interval struct {
	Min int64
	Max int64
}

type Mapping

type Mapping struct {
	URI      string
	Method   myhttp.HTTPMethod
	Policies []*Policy
}

type MockuMappings

type MockuMappings struct {
	Mappings  []*Mapping
	Filenames []string
	Config    *Config
}

func (*MockuMappings) GroupMethodsByURI added in v1.1.4

func (m *MockuMappings) GroupMethodsByURI() map[string][]myhttp.HTTPMethod

func (*MockuMappings) IsEmpty added in v1.1.4

func (m *MockuMappings) IsEmpty() bool

type NameJSONPair added in v1.1.4

type NameJSONPair struct {
	Name string
	JSON myjson.ExtJSONMatcher
}

type NameRegexpPair

type NameRegexpPair struct {
	Name   string
	Regexp *regexp.Regexp
}

type NameValuesPair

type NameValuesPair struct {
	Name   string
	Values []string
}

type Parser added in v1.1.4

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

func NewParser added in v1.1.4

func NewParser(filename string) *Parser

func (*Parser) Parse added in v1.1.4

func (p *Parser) Parse() (r *MockuMappings, e error)

type Policy

type Policy struct {
	When     *When
	CmdType  CmdType
	Returns  *Returns
	Forwards *Forwards
}

type Returns

type Returns struct {
	StatusCode myhttp.StatusCode
	Headers    []*NameValuesPair
	Body       []byte
	Latency    *Interval
}

type When

type When struct {
	Headers       []*NameValuesPair
	HeaderRegexps []*NameRegexpPair
	HeaderJSONs   []*NameJSONPair

	Params       []*NameValuesPair
	ParamRegexps []*NameRegexpPair
	ParamJSONs   []*NameJSONPair

	PathVars       []*NameValuesPair
	PathVarRegexps []*NameRegexpPair

	Body       []byte
	BodyRegexp *regexp.Regexp
	BodyJSON   *myjson.ExtJSONMatcher
}

Jump to

Keyboard shortcuts

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