domain

package
v0.0.0-...-d46a54d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	ID             int64
	Service        string
	Priority       int64
	MatcherRegex   []*regexp.Regexp
	IdentityRegex  *regexp.Regexp
	Template       template.Template
	TemplateBytes  []byte
	Timeout        time.Duration
	ResponseStatus int
	IsReadOnly     bool
}

Rule describes rules how to mock requests

func (Rule) MatchIdentity

func (r Rule) MatchIdentity(requestBody []byte) (string, bool)

MatchIdentity matches identity (if there is) from request body

type Rules

type Rules []Rule

Rules is collection type for Rule structures

func ConvertRules

func ConvertRules(rules config.RuleConfigs) (Rules, error)

ConvertRules converts config to rules domain object

func (Rules) MatchRegex

func (r Rules) MatchRegex(requestBody []byte) (Rule, bool)

MatchRegex returns first rule matching its regex

func (Rules) MatchService

func (r Rules) MatchService(service string) Rules

MatchService returns slice of Rules matching given service name

Jump to

Keyboard shortcuts

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