Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 893 Bytes

README.md

File metadata and controls

33 lines (20 loc) · 893 Bytes

func(http.Handler) http.Handler

Go Reference Codebeat Score

General Middleware

  • NOOP does nothing

Content Negotiation

  • AcceptMiddleware() alters the Accept header so only a given set is passed to the next handler in the chain

Error Handling Middleware

  • WithErrorHandlerMiddleware()

Special Handlers

  • HTTPSRedirectHandler a handler that will redirect to https if non-https, or return 404 already https

Error Handlers

we define an ErrorHandler as a function like:

func (http.ResponseWriter, *http.Request, error)

WithErrorHandler() and ErrorHandler() add and read the context for such handler