middleware

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlanesSegment         = "/planes"
	ResourceGroupsSegment = "/resourcegroups"
)

Variables

This section is empty.

Functions

func GetRelativePath

func GetRelativePath(pathBase string, path string) string

GetRelativePath returns the relative path of the given path with respect to the pathBase.

func LowercaseURLPath

func LowercaseURLPath(next http.Handler) http.Handler

LowercaseURLPath sets the Referer header to the original URL if it is not already set, and then lowercases the URL path before passing it to the next handler.

func NormalizePath

func NormalizePath(next http.Handler) http.Handler

NormalizePath replaces any occurrences of "planes" and "resourcegroups" in the URL path with the correct case and preserves the case for the rest of the URL. For example, the user could specify the url as /Planes/radius/local/resourceGroups/abc and this will translate it to: /planes/radius/local/resourcegroups/abc

func Recoverer

func Recoverer(h http.Handler) http.Handler

Recoverer handles panics and logs the error, returning an Internal Server Error response.

func RemoveRemoteAddr

func RemoveRemoteAddr(next http.Handler) http.Handler

RemoveRemoteAddr is the middleware to remove remoteaddr to avoid high cardinality in metrics. This is a temporary workaround until opentelemetry-go fixes the issue - https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3765

func WithLogger

func WithLogger(h http.Handler) http.Handler

WithLogger adds logger to the context based on the Resource ID (if present).

Types

This section is empty.

Jump to

Keyboard shortcuts

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