types

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Middleware_type_code_encoding_map = map[MiddlewareType]string{
	MiddlewareType_Unknown:        "unknown",
	MiddlewareType_BeforeResponse: "before_response",
}

Functions

This section is empty.

Types

type EndpointConfig

type EndpointConfig struct {
	Route              string                 `json:"route"`
	Method             string                 `json:"method"`
	Response           EndpointConfigResponse `json:"response"`
	ResponseStatusCode int                    `json:"response_status_code"`
	ResponseIf         []ResponseIf           `json:"response_if"`
	Headers            map[string]string      `json:"response_headers"`
	HeadersBase        map[string]string      `json:"response_headers_base"`
}

type EndpointConfigResponse

type EndpointConfigResponse []byte

func (*EndpointConfigResponse) UnmarshalJSON

func (ecr *EndpointConfigResponse) UnmarshalJSON(data []byte) (err error)

type Endpoint_content_type

type Endpoint_content_type int
const (
	Endpoint_content_type_file Endpoint_content_type = iota
	Endpoint_content_type_shell
	Endpoint_content_type_exec
	Endpoint_content_type_fileserver
	Endpoint_content_type_json
	Endpoint_content_type_plaintext
	Endpoint_content_type_unknown
)

type MiddlewareConfig added in v1.0.0

type MiddlewareConfig struct {
	Exec       string         `json:"exec"`
	Type       MiddlewareType `json:"type"`
	RouteMatch string         `json:"route_match"`
	Condition  *Condition     `json:"condition"`
}

type MiddlewareType added in v1.0.0

type MiddlewareType int
const (
	MiddlewareType_Unknown MiddlewareType = iota
	MiddlewareType_BeforeResponse
)

func (*MiddlewareType) UnmarshalJSON added in v1.0.0

func (mt *MiddlewareType) UnmarshalJSON(data []byte) (err error)

type MockFs

type MockFs interface {
	StoreRequestRecord(requestRecord *RequestRecord, endpointConfig *EndpointConfig) error
	GetRecordsMatchingRoute(route string) ([]RequestRecord, error)
	RemoveAllRequestRecords() error
}

type ReadFileFunc added in v1.0.0

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

type RequestRecord

type RequestRecord struct {
	Route             string            `json:"route"`
	Querystring       string            `json:"querystring"`
	QuerystringParsed map[string]string `json:"querystring_parsed"`
	Method            string            `json:"method"`
	Host              string            `json:"host"`
	Https             bool              `json:"https"`
	Headers           http.Header       `json:"headers"`
	Body              *[]byte           `json:"body"`
	RouteParams       map[string]string `json:"route_params"`
}

type ResponseIf

type ResponseIf struct {
	Response           EndpointConfigResponse `json:"response"`
	ResponseStatusCode int                    `json:"response_status_code"`
	Condition          *Condition             `json:"condition"`
	Headers            map[string]string      `json:"response_headers"`
}

type State

type State struct {
	ListenPort                 string
	RequestRecordDirectoryPath string
	ConfigFolderPath           string
}

Jump to

Keyboard shortcuts

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