middlewares

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderXTraceID = "X-Trace-ID"

Variables

View Source
var (
	DefaultSpanNameFormatter = func(_ string, r *http.Request) string {
		var b strings.Builder

		b.WriteString(r.Method)
		b.WriteString(":")
		b.WriteString(decreasePathCardinality(r.URL.Path))

		return b.String()
	}

	DefaultFilter = func(r *http.Request) bool {
		if k, ok := r.Header["Upgrade"]; ok {
			for _, v := range k {
				if v == "websocket" {
					return false
				}
			}
		}

		return r.Method != http.MethodGet || !strings.HasPrefix(r.URL.RequestURI(), "/health")
	}
)

Functions

func CORSMiddleware

func CORSMiddleware(methods ...string) http.HandlerFunc

CORSMiddleware implement cors request

func Recover

func Recover(next http.Handler) http.Handler

func RecoverFiber

func RecoverFiber(next fiber.Handler) fiber.Handler

func Telemetry

func Telemetry() func(next fiber.Handler) fiber.Handler

func Timing

func Timing(next fiber.Handler) fiber.Handler

Timing calculate time of request

func URLWithoutQuery

func URLWithoutQuery(r *http.Request) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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