Versions in this module Expand all Collapse all v0 v0.1.0 May 12, 2024 Changes in this version + func APIAuth(next http.Handler) http.Handler + func APIAuthOptional(next http.Handler) http.Handler + func GetUserID(r *phi.Request) *primitive.ObjectID + func JWTAuth(next http.Handler) http.Handler + func JWTAuthOptional(next http.Handler) http.Handler + func JWTOrAPIAuth(next http.Handler) http.Handler + func JWTOrAPIAuthOptional(next http.Handler) http.Handler + func SetTokenCheckFunc(fn func(username, password string) (*Token, error)) + func SetUnauthorizedFunc(fn func() *phi.Error) + type TOKEN_TYPE string + const TOKEN_CONTEXT + type Token struct + ID string + Subject string + func GetToken(r *phi.Request) *Token + func ImplementAccessCheck(username, password string) (*Token, error) v0.0.6 Jan 25, 2023 Changes in this version + const RequestIDKey + var DefaultLogger func(next http.Handler) http.Handler + var IsTTY bool + var LogEntryCtxKey = &contextKey + var RequestIDHeader = "X-Request-Id" + var URLFormatCtxKey = &contextKey + func AllowContentEncoding(contentEncoding ...string) func(next http.Handler) http.Handler + func AllowContentType(contentTypes ...string) func(next http.Handler) http.Handler + func BasicAuth(realm string, creds map[string]string) func(next http.Handler) http.Handler + func CleanPath(next http.Handler) http.Handler + func Compress(level int, types ...string) func(next http.Handler) http.Handler + func ContentCharset(charsets ...string) func(next http.Handler) http.Handler + func GetHead(next http.Handler) http.Handler + func GetReqID(ctx context.Context) string + func Heartbeat(endpoint string) func(http.Handler) http.Handler + func Logger(next http.Handler) http.Handler + func Maybe(mw func(http.Handler) http.Handler, maybeFn func(r *http.Request) bool) func(http.Handler) http.Handler + func New(h http.Handler) func(next http.Handler) http.Handler + func NextRequestID() uint64 + func NoCache(h http.Handler) http.Handler + func PageRoute(path string, handler http.Handler) func(http.Handler) http.Handler + func PathRewrite(old, new string) func(http.Handler) http.Handler + func PrintPrettyStack(rvr interface{}) + func Profiler() http.Handler + func RealIP(h http.Handler) http.Handler + func Recoverer(next http.Handler) http.Handler + func RedirectSlashes(next http.Handler) http.Handler + func RequestID(next http.Handler) http.Handler + func RequestLogger(f LogFormatter) func(next http.Handler) http.Handler + func SetHeader(key, value string) func(next http.Handler) http.Handler + func StripSlashes(next http.Handler) http.Handler + func Throttle(limit int) func(http.Handler) http.Handler + func ThrottleBacklog(limit, backlogLimit int, backlogTimeout time.Duration) func(http.Handler) http.Handler + func ThrottleWithOpts(opts ThrottleOpts) func(http.Handler) http.Handler + func Timeout(timeout time.Duration) func(next http.Handler) http.Handler + func URLFormat(next http.Handler) http.Handler + func WithLogEntry(r *http.Request, entry LogEntry) *http.Request + func WithValue(key, val interface{}) func(next http.Handler) http.Handler + type Compressor struct + func NewCompressor(level int, types ...string) *Compressor + func (c *Compressor) Handler(next http.Handler) http.Handler + func (c *Compressor) SetEncoder(encoding string, fn EncoderFunc) + type DefaultLogFormatter struct + Logger LoggerInterface + NoColor bool + func (l *DefaultLogFormatter) NewLogEntry(r *http.Request) LogEntry + type EncoderFunc func(w io.Writer, level int) io.Writer + type HeaderRoute struct + MatchAny []Pattern + MatchOne Pattern + Middleware func(next http.Handler) http.Handler + func (r HeaderRoute) IsMatch(value string) bool + type HeaderRouter map[string][]HeaderRoute + func RouteHeaders() HeaderRouter + func (hr HeaderRouter) Handler(next http.Handler) http.Handler + func (hr HeaderRouter) Route(header, match string, middlewareHandler func(next http.Handler) http.Handler) HeaderRouter + func (hr HeaderRouter) RouteAny(header string, match []string, ...) HeaderRouter + func (hr HeaderRouter) RouteDefault(handler func(next http.Handler) http.Handler) HeaderRouter + type LogEntry interface + Panic func(v interface{}, stack []byte) + Write func(status, bytes int, header http.Header, elapsed time.Duration, ...) + func GetLogEntry(r *http.Request) LogEntry + type LogFormatter interface + NewLogEntry func(r *http.Request) LogEntry + type LoggerInterface interface + Print func(v ...interface{}) + type Pattern struct + func NewPattern(value string) Pattern + func (p Pattern) Match(v string) bool + type ThrottleOpts struct + BacklogLimit int + BacklogTimeout time.Duration + Limit int + RetryAfterFn func(ctxDone bool) time.Duration + type WrapResponseWriter interface + BytesWritten func() int + Status func() int + Tee func(io.Writer) + Unwrap func() http.ResponseWriter + func NewWrapResponseWriter(w http.ResponseWriter, protoMajor int) WrapResponseWriter