core

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClient

func BuildClient(config *HTTPConfig) *http.Client

func BuildHTTPRequest

func BuildHTTPRequest(config *HTTPConfig) (*http.Request, error)

func ParseConfig

func ParseConfig(configBytes []byte) (map[string]interface{}, error)

func ReadConfig

func ReadConfig(cfgFile string) ([]byte, error)

func SetConfig

func SetConfig(appConfig map[string]interface{}) error

Types

type HTTPConfig

type HTTPConfig struct {
	Method      string
	Scheme      string
	Host        string
	Path        string
	Headers     map[string]string
	Payload     map[string]interface{} //[]byte
	QueryParams map[string]string      `yaml:"query_params"`
}

func (HTTPConfig) EndpointUrl added in v0.1.2

func (config HTTPConfig) EndpointUrl() *url.URL

func (HTTPConfig) RequestUrl added in v0.1.2

func (config HTTPConfig) RequestUrl() (*url.URL, error)

type InvalidHTTPMethodError

type InvalidHTTPMethodError struct {
	Method string
}

func (*InvalidHTTPMethodError) Error

func (m *InvalidHTTPMethodError) Error() string

type InvalidRequestConfigError

type InvalidRequestConfigError struct {
	Config interface{}
}

func (*InvalidRequestConfigError) Error

func (e *InvalidRequestConfigError) Error() string

type MissingRequiredConfigError

type MissingRequiredConfigError struct {
	Key string
}

func (*MissingRequiredConfigError) Error

type RequestConfig

type RequestConfig struct {
	Name      string
	GroupName string
	*HTTPConfig
}

func FetchRequestConfigByName

func FetchRequestConfigByName(group string, reqName string) (*RequestConfig, error)

func FetchRequestConfigs

func FetchRequestConfigs() []*RequestConfig

func FetchRequestConfigsByGroup

func FetchRequestConfigsByGroup(group string) []*RequestConfig

type RequestExecution

type RequestExecution struct {
	Request      *http.Request
	Response     *http.Response
	ResponseBody string
}

func Execute

func Execute(reqConfig *RequestConfig) (*RequestExecution, error)

Run entire request based off of config

func PerformRequest

func PerformRequest(req *http.Request, client *http.Client) (*RequestExecution, error)

type RequestGroup

type RequestGroup struct {
	Name     string
	Requests []*RequestConfig
	*HTTPConfig
}

type RequestNotFoundError added in v0.1.1

type RequestNotFoundError struct {
	Path string
}

func (*RequestNotFoundError) Error added in v0.1.1

func (m *RequestNotFoundError) Error() string

Jump to

Keyboard shortcuts

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