mock

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kind is the kind of Mock.
	Kind = "Mock"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchRule added in v1.4.1

type MatchRule struct {
	Path            string                          `yaml:"path,omitempty" jsonschema:"omitempty,pattern=^/"`
	PathPrefix      string                          `yaml:"pathPrefix,omitempty" jsonschema:"omitempty,pattern=^/"`
	Headers         map[string]*urlrule.StringMatch `yaml:"headers" jsonschema:"omitempty"`
	MatchAllHeaders bool                            `yaml:"matchAllHeaders" jsonschema:"omitempty"`
}

MatchRule is the rule to match a request

type Mock

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

Mock is filter Mock.

func (*Mock) Close

func (m *Mock) Close()

Close closes Mock.

func (*Mock) DefaultSpec

func (m *Mock) DefaultSpec() interface{}

DefaultSpec returns default spec of Mock.

func (*Mock) Description

func (m *Mock) Description() string

Description returns the description of Mock.

func (*Mock) Handle

func (m *Mock) Handle(ctx context.HTTPContext) string

Handle mocks HTTPContext.

func (*Mock) Inherit

func (m *Mock) Inherit(filterSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter)

Inherit inherits previous generation of Mock.

func (*Mock) Init

func (m *Mock) Init(filterSpec *httppipeline.FilterSpec)

Init initializes Mock.

func (*Mock) Kind

func (m *Mock) Kind() string

Kind returns the kind of Mock.

func (*Mock) Results

func (m *Mock) Results() []string

Results returns the results of Mock.

func (*Mock) Status

func (m *Mock) Status() interface{}

Status returns status.

type Rule

type Rule struct {
	Match   MatchRule         `yaml:"match" jsonschema:"required"`
	Code    int               `yaml:"code" jsonschema:"required,format=httpcode"`
	Headers map[string]string `yaml:"headers" jsonschema:"omitempty"`
	Body    string            `yaml:"body" jsonschema:"omitempty"`
	Delay   string            `yaml:"delay" jsonschema:"omitempty,format=duration"`
	// contains filtered or unexported fields
}

Rule is the mock rule.

type Spec

type Spec struct {
	Rules []*Rule `yaml:"rules"`
}

Spec describes the Mock.

Jump to

Keyboard shortcuts

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