Documentation
¶
Index ¶
- func AddContextValue(req *http.Request, key, value any)
- func File(contentType string, f io.Reader) func(w http.ResponseWriter, req *http.Request)
- func GetContextValue[t any](req *http.Request, key any, value *t) bool
- func Handle(handlers ...any) func(w http.ResponseWriter, req *http.Request)
- func HasContextValue[t any](req *http.Request, key any) bool
- func Html(str string) func(w http.ResponseWriter, req *http.Request)
- func JwtClaims(req *http.Request) jwt.Claims
- func PathParams(req *http.Request) url.Values
- type ChainHandler
- type JwtAuth
- type ResponseBuilder
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContextValue ¶ added in v0.8.0
func GetContextValue ¶ added in v0.8.0
Types ¶
type ChainHandler ¶
type ChainHandler func(http.ResponseWriter, *http.Request) bool
var Get ChainHandler = Method("GET")
var Path ChainHandler = Method("PATCH")
var Post ChainHandler = Method("POST")
var Put ChainHandler = Method("PUT")
func BasicAuthHandler ¶
func BasicAuthHandler(user, pass string) ChainHandler
func Method ¶
func Method(method string) ChainHandler
func NopHandler ¶ added in v0.5.1
func NopHandler() ChainHandler
type JwtAuth ¶ added in v0.8.0
type JwtAuth struct {
// contains filtered or unexported fields
}
func NewJwtAuth ¶ added in v0.8.0
func (*JwtAuth) LoginHandler ¶ added in v0.8.0
func (ja *JwtAuth) LoginHandler() http.HandlerFunc
func (*JwtAuth) SampleAuthForm ¶ added in v0.8.0
func (ja *JwtAuth) SampleAuthForm(target, redirect string) http.HandlerFunc
func (*JwtAuth) SoftAuthHandler ¶ added in v0.8.0
func (ja *JwtAuth) SoftAuthHandler() ChainHandler
func (*JwtAuth) StrictAuthHandler ¶ added in v0.8.0
func (ja *JwtAuth) StrictAuthHandler(redirect string) ChainHandler
type ResponseBuilder ¶
type ResponseBuilder interface {
Status(status int) ResponseBuilder
WithBody(body any) ResponseBuilder
WithHeader(key, value string) ResponseBuilder
WithCookie(cookie *http.Cookie) ResponseBuilder
Redirect(redirect string)
As(contentType string)
AsTextPlain()
AsJson()
AsHtml()
}
func Response ¶ added in v0.8.0
func Response(w http.ResponseWriter) ResponseBuilder
type Router ¶ added in v0.8.0
type Router struct {
// contains filtered or unexported fields
}
func (*Router) NotFound ¶ added in v0.8.0
func (r *Router) NotFound(handler http.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.