middleware

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 13 Imported by: 3

Documentation

Overview

Package middleware provides reusable HTTP middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recovery added in v2.3.0

func Recovery(log *logger.Logger) func(http.Handler) http.Handler

Recovery is a wrapper for WithRecovery.

func RequestID added in v2.7.0

func RequestID() func(http.Handler) http.Handler

RequestID is a wrapper for WithRequestID.

func Stats added in v2.3.0

func Stats(name string, s *statter.Statter) func(http.Handler) http.Handler

Stats is a wrapper for WithStats.

func Tracing added in v2.6.0

func Tracing(op string, opts ...otelhttp.Option) func(http.Handler) http.Handler

Tracing collects traces on HTTP requests.

func WithRecovery

func WithRecovery(h http.Handler, log *logger.Logger) http.Handler

WithRecovery recovers from panics and log the error.

func WithRequestID added in v2.7.0

func WithRequestID(h http.Handler) http.Handler

WithRequestID sets the request id on request context and in the response.

func WithStats

func WithStats(name string, s *statter.Statter, h http.Handler) http.Handler

WithStats collects statistics about HTTP requests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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