mock

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 5 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 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) (result 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 {
	Path       string            `yaml:"path,omitempty" jsonschema:"omitempty,pattern=^/"`
	PathPrefix string            `yaml:"pathPrefix,omitempty" jsonschema:"omitempty,pattern=^/"`
	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