request

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 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 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 IDFromContext added in v0.0.20

func IDFromContext(r *http.Request) string

IDFromContext retrieves the `X-Request-ID` from the current 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`.

func MethodFromContext added in v0.0.20

func MethodFromContext(r *http.Request) string

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

func PathFromContext added in v0.0.20

func PathFromContext(r *http.Request) string

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

func ProtocolFromContext added in v0.0.20

func ProtocolFromContext(r *http.Request) string

ProtocolFromContext retrieves the request protocol from the current 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