middlewares

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth added in v0.11.10

func BasicAuth(username, password string) string

BasicAuth returns the encoded Basic Authentication header.

func CheckReadiness

func CheckReadiness(url string, apiUser string, apiPass string) echo.MiddlewareFunc

func Proxy added in v0.11.10

func Proxy(config ProxyConfig) echo.MiddlewareFunc

Proxy returns a proxy middleware that forwards the request to the target server.

func RequestIdAndDetailsIssuer

func RequestIdAndDetailsIssuer(next echo.HandlerFunc) echo.HandlerFunc

func ResponseBodyDump

func ResponseBodyDump() echo.MiddlewareFunc

func TracingMiddleware

func TracingMiddleware(next echo.HandlerFunc) echo.HandlerFunc

Define Tracing middleware

func Zerologger

func Zerologger(skipRules []logfilter.SkipRule) echo.MiddlewareFunc

Types

type CustomRoundTripper added in v0.11.10

type CustomRoundTripper struct {
	Transport    http.RoundTripper
	BasicAuthStr string
}

CustomRoundTripper is a custom implementation of http.RoundTripper to modify request headers.

func (*CustomRoundTripper) RoundTrip added in v0.11.10

func (c *CustomRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction and adds custom headers.

type ProxyConfig added in v0.11.10

type ProxyConfig struct {
	URL          *url.URL
	SkipPatterns [][]string
	// Rewrite defines URL path rewrite rules. The values captured in asterisk can be
	// retrieved by index e.g. $1, $2 and so on.
	// Examples:
	// "/old":              "/new",
	// "/api/*":            "/$1",
	// "/js/*":             "/public/javascripts/$1",
	// "/users/*/orders/*": "/user/$1/order/$2",
	Rewrite map[string]string
	// RegexRewrite defines rewrite rules using regexp.Rexexp with captures
	// Every capture group in the values can be retrieved by index e.g. $1, $2 and so on.
	// Example:
	// "^/old/[0.9]+/":     "/new",
	// "^/api/.+?/(.*)":    "/v2/$1",
	RegexRewrite   map[*regexp.Regexp]string
	ModifyResponse func(res *http.Response) error
	Username       string
	Password       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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