mocking

package
v0.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JsonMediaTypePattern = regexp.MustCompile("^application/.*json$")
	XmlMediaTypePattern  = regexp.MustCompile("^application/.*xml$")
	TextMediaTypePattern = regexp.MustCompile("^text/.*$")
)

Functions

This section is empty.

Types

type MockConfig

type MockConfig map[string]*MockResponse

Mapping of Mock ID to MockResponses

func NewMockConfig

func NewMockConfig() *MockConfig

func (MockConfig) AddMockResponse

func (m MockConfig) AddMockResponse(mockID string, resp *MockResponse) error

func (MockConfig) GenerateMockResponse

func (m MockConfig) GenerateMockResponse(op *openapi3.Operation) (*MockResponse, error)

func (MockConfig) GetMockResponse

func (m MockConfig) GetMockResponse(mockID string) *MockResponse

type MockResponse

type MockResponse struct {
	// 200, 201
	StatusCode int
	// application/json -> []byte
	// application/xml -> []byte
	MediaTypeData map[string][]byte
}

func NewMockResponse

func NewMockResponse() *MockResponse

Jump to

Keyboard shortcuts

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