mock

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResponseFileDoesNotExist = errors.New("ErrResponseFileDoesNotExist")

Functions

func ParseAssertRequest

func ParseAssertRequest(req *http.Request) (*AssertConfig, error)

func Validate

func Validate(
	mockFs types.MockFs,
	assertConfig *AssertConfig,
) (*[]ValidationError, error)

Types

type EndpointConfigError

type EndpointConfigError struct {
	Code          EndpointConfigErrorCode
	EndpointIndex int
	Metadata      map[string]string
}

func ValidateEndpointConfigs

func ValidateEndpointConfigs(endpointConfigs []types.EndpointConfig) ([]EndpointConfigError, error)

type EndpointConfigErrorCode

type EndpointConfigErrorCode int
const (
	EndpointConfigErrorCode_Unknown EndpointConfigErrorCode = iota
	EndpointConfigErrorCode_EndpointDuplicate
	EndpointConfigErrorCode_InvalidMethod
	EndpointConfigErrorCode_RouteWithQuerystring
)

type ReadFileFunc

type ReadFileFunc = func(name string) ([]byte, error)

type Response

type Response struct {
	Body                []byte
	EndpointContentType types.Endpoint_content_type
	StatusCode          int
	Headers             map[string]string
}

func ResolveEndpointResponse

func ResolveEndpointResponse(
	readFile ReadFileFunc,
	request *http.Request,
	requestBody []byte,
	state *types.State,
	endpointConfig *types.EndpointConfig,
) (*Response, error, map[string]string)

Jump to

Keyboard shortcuts

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