request

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxRequestProtocolKey ctxInfo = iota
	CtxRequestMethodKey
	CtxRequestPathKey
)
View Source
const CtxRequestIDKey = ctxID(iota)

Variables

This section is empty.

Functions

func CtxRequestID added in v0.0.4

func CtxRequestID(r *http.Request) string

CtxRequestID retrieves the `X-Request-ID` from the current request `context`.

func CtxRequestMethod added in v0.0.4

func CtxRequestMethod(r *http.Request) string

CtxRequestMethod retrieves the request method from the current request `context`.

func CtxRequestPath added in v0.0.4

func CtxRequestPath(r *http.Request) string

CtxRequestPath retrieves the request path from the current request `context`.

func CtxRequestProtocol added in v0.0.4

func CtxRequestProtocol(r *http.Request) string

CtxRequestProtocol retrieves the request protocol from the current request `context`.

func ID added in v0.0.4

func ID(h http.Handler) http.Handler

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

func Info added in v0.0.4

func Info(h http.Handler) http.Handler

Info is a server level middleware. It is called on every request to construct request protocol, method and path values then added to request `context`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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