utils

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CondVal

func CondVal(data, value interface{}) interface{}

func CreateClient

func CreateClient(options ClientRouteOption, proxyRoute gobis.ProxyRoute) *http.Client

func NewGobisSourceExtractor

func NewGobisSourceExtractor(variable string) (utils.SourceExtractor, error)

func PathHandler

func PathHandler(path string, next http.Handler, handlerFunc func(http.ResponseWriter, *http.Request)) http.Handler

func RandString

func RandString(length int) string

func RequiredVal

func RequiredVal(elems ...interface{}) error

Types

type ClientRouteOption

type ClientRouteOption struct {
	// Set to true to use the same proxy as you could use for you route
	UseRouteTransport bool `mapstructure:"use_route_transport" json:"use_route_transport" yaml:"use_route_transport"`
	// Set to true to skip certificate check (NOT RECOMMENDED)
	InsecureSkipVerify bool `mapstructure:"insecure_skip_verify" json:"insecure_skip_verify" yaml:"insecure_skip_verify"`
}

type GobisSourceExtractor

type GobisSourceExtractor struct {
	// contains filtered or unexported fields
}

func (GobisSourceExtractor) Extract

func (e GobisSourceExtractor) Extract(req *http.Request) (string, int64, error)

type ResponseData added in v1.2.0

type ResponseData struct {
	Header http.Header
	Code   int
	Body   []byte
}

type ResponseModifier added in v1.2.0

type ResponseModifier struct {
	// contains filtered or unexported fields
}

func NewResponseModifier added in v1.2.0

func NewResponseModifier(rw http.ResponseWriter) *ResponseModifier

func (ResponseModifier) Header added in v1.2.0

func (rm ResponseModifier) Header() http.Header

func (ResponseModifier) Modify added in v1.2.0

func (rm ResponseModifier) Modify(mod func(data ResponseData) (ResponseData, error)) error

func (ResponseModifier) Write added in v1.2.0

func (rm ResponseModifier) Write(body []byte) (int, error)

func (ResponseModifier) WriteHeader added in v1.2.0

func (rm ResponseModifier) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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