middleware

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIDCtxKey = request(iota)
	RequestProtocolCtxKey
	RequestMethodCtxKey
	RequestPathCtxKey
)

Variables

This section is empty.

Functions

func Request added in v0.0.23

func Request(h http.Handler) http.Handler

Request is a server level middleware. It is called on every request to handle `X-Request-ID` header as well as the protocol, method and the URI. If the `X-Request-ID` header already exists in the request, nothing else is done otherwise a new UUID V4 format is generated and added to request `context`.

func Router

func Router(h http.HandlerFunc, middleware ...rtr) http.HandlerFunc

Router allows router level middleware chaining. The first middleware in the chain runs last. Server level middleware always take precedence over router level middleware.

func Server

func Server(h http.Handler, middleware ...srv) http.Handler

Server allows server level middleware chaining. The first middleware in the chain runs last. Server level middleware always take precedence over router level middleware.

Types

This section is empty.

Jump to

Keyboard shortcuts

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