Documentation ¶
Index ¶
- Variables
- func AuthnGuardian(encoder khttp.EncodeErrorFunc, handler http.Handler) http.Handler
- func AuthzGuardian(srv authz.Service, requirement authz.RequirementList, ...) http.Handler
- func ClientIP(ctx context.Context) string
- func ClientUserAgent(ctx context.Context) string
- func HandlerWrap[TRet any](resEncoder khttp.EncodeResponseFunc, handler HandlerFunc[TRet]) http.HandlerFunc
- func Host(ctx context.Context) string
- func IsAjax(ctx context.Context) bool
- func IsSecure(ctx context.Context) bool
- func IsWebsocket(ctx context.Context) bool
- func MiddlewareConvert(errEncoder khttp.EncodeErrorFunc, m ...middleware.Middleware) func(handler http.Handler) http.Handler
- func MountBlob(srv *khttp.Server, pathPrefix, basePath string, b vfs.Blob)
- func PatchOpts(l log.Logger, opts []khttp.ServerOption, server *conf.Server, ...) []khttp.ServerOption
- func ResolveHttpRequest(ctx context.Context) (*http.Request, bool)
- func SetCookie(ctx context.Context, cookie *http.Cookie) error
- type Handler
- type HandlerFunc
- type Server
- type ServiceRegister
- type ServiceRegisterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ReqDecode khttp.DecodeRequestFunc = khttp.DefaultRequestDecoder ResEncoder khttp.EncodeResponseFunc = khttp.DefaultResponseEncoder ErrEncoder khttp.EncodeErrorFunc = khttp.DefaultErrorEncoder )
Functions ¶
func AuthnGuardian ¶
func AuthzGuardian ¶
func AuthzGuardian(srv authz.Service, requirement authz.RequirementList, encoder khttp.EncodeErrorFunc, handler http.Handler) http.Handler
AuthzGuardian guard http.Handler with authz
func ClientUserAgent ¶
func HandlerWrap ¶
func HandlerWrap[TRet any](resEncoder khttp.EncodeResponseFunc, handler HandlerFunc[TRet]) http.HandlerFunc
func IsWebsocket ¶
func MiddlewareConvert ¶
func MiddlewareConvert(errEncoder khttp.EncodeErrorFunc, m ...middleware.Middleware) func(handler http.Handler) http.Handler
MiddlewareConvert convert kratos middleware into standard http middleware
func PatchOpts ¶
func PatchOpts(l log.Logger, opts []khttp.ServerOption, server *conf.Server, sCfg *conf.Security, reqDecoder khttp.DecodeRequestFunc, resEncoder khttp.EncodeResponseFunc, errEncoder khttp.EncodeErrorFunc, f ...khttp.FilterFunc) []khttp.ServerOption
PatchOpts Patch http options with given service name and configs. f use global filters
Types ¶
type HandlerFunc ¶
type ServiceRegister ¶
type ServiceRegister interface {
Register(server *khttp.Server, middleware ...middleware.Middleware)
}
ServiceRegister register http handler into http server
func ChainServiceRegister ¶
func ChainServiceRegister(r ...ServiceRegister) ServiceRegister
type ServiceRegisterFunc ¶
type ServiceRegisterFunc func(server *khttp.Server, middleware ...middleware.Middleware)
func (ServiceRegisterFunc) Register ¶
func (f ServiceRegisterFunc) Register(server *khttp.Server, middleware ...middleware.Middleware)
Click to show internal directories.
Click to hide internal directories.