20 lines
415 B
Go
20 lines
415 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
// ResponseHandle is a function that middleware call in case of stop chain
|
||
|
type ResponseHandle func(w http.ResponseWriter, r *http.Request, err error)
|
||
|
|
||
|
// CtxKey is a key to use with context.WithValue
|
||
|
type CtxKey struct {
|
||
|
Pkg string
|
||
|
Name string
|
||
|
}
|
||
|
|
||
|
// String returns string representation
|
||
|
func (s *CtxKey) String() string {
|
||
|
return s.Pkg + " context value " + s.Name
|
||
|
}
|