mid

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mid provides HTTP middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestID

func GetRequestID(r *http.Request) xid.ID

GetRequestID gets the request ID for a given request.

func Logger

func Logger(logger *zap.Logger) func(http.Handler) http.Handler

Logger adds a logger to a Handler chain.

func Recoverer

func Recoverer(next http.Handler) http.Handler

Recoverer recovers from panics, writing out an HTTP error message when needed.

func RequestID

func RequestID(next http.Handler) http.Handler

RequestID ensures that a request ID exists on the request and is propogated to logging and the outgoing response.

func RequestLogger

func RequestLogger(next http.Handler) http.Handler

RequestLogger logs information about the request, including the method, URL, status, size, and handle duration.

func Tracer

func Tracer(next http.Handler) http.Handler

Tracer traces the handler with an OpenCensus HTTP tracer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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