Documentation ¶
Index ¶
- Variables
- func ClientIP(ctx context.Context) string
- func ClientUserAgent(ctx context.Context) string
- func ErrorFormatter() func(err error) (interface{}, error)
- func HandleBlobs(basePath string, cfg blob.Config, srv *khttp.Server, factory blob.Factory)
- func HandlerWrap[TRet any](resEncoder khttp.EncodeResponseFunc, handler HandlerFunc[TRet]) http.HandlerFunc
- 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 PatchFilter(logger klog.Logger, c *conf.Logging) klog.Logger
- func PatchGrpcOpts(l log.Logger, opts []grpc.ServerOption, name string, services *conf.Services) []grpc.ServerOption
- func PatchHttpOpts(l log.Logger, opts []khttp.ServerOption, name string, services *conf.Services, ...) []khttp.ServerOption
- func ResolveHttpRequest(ctx context.Context) (*http.Request, bool)
- func Saas(hmtOpt *shttp.WebMultiTenancyOption, ts common.TenantStore, ...) middleware.Middleware
- func SetCookie(ctx context.Context, value string) bool
- type DefaultErrorHandler
- type ErrorHandler
- type Handler
- type HandlerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ReqDecode http.DecodeRequestFunc = http.DefaultRequestDecoder ResEncoder http.EncodeResponseFunc = http.DefaultResponseEncoder ErrEncoder http.EncodeErrorFunc = http.DefaultErrorEncoder )
View Source
var DefaultCodecProviderSet = wire.NewSet(wire.Value(ReqDecode), wire.Value(ResEncoder), wire.Value(ErrEncoder), NewDefaultErrorHandler, wire.Bind(new(ErrorHandler), new(*DefaultErrorHandler)))
Functions ¶
func ClientUserAgent ¶
func ErrorFormatter ¶ added in v0.0.2
func HandleBlobs ¶
func HandlerWrap ¶ added in v0.0.2
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
func PatchFilter ¶ added in v0.0.2
func PatchGrpcOpts ¶
func PatchGrpcOpts(l log.Logger, opts []grpc.ServerOption, name string, services *conf.Services) []grpc.ServerOption
PatchGrpcOpts Patch grpc options with given service name and configs
func PatchHttpOpts ¶
func PatchHttpOpts(l log.Logger, opts []khttp.ServerOption, name string, services *conf.Services, sCfg *conf.Security, reqDecoder khttp.DecodeRequestFunc, resEncoder khttp.EncodeResponseFunc, errEncoder khttp.EncodeErrorFunc, f ...khttp.FilterFunc) []khttp.ServerOption
PatchHttpOpts Patch khttp options with given service name and configs. f use global filters
func Saas ¶ added in v0.0.2
func Saas(hmtOpt *shttp.WebMultiTenancyOption, ts common.TenantStore, trustedContextValidator api.TrustedContextValidator, options ...common.PatchTenantResolveOption) middleware.Middleware
Types ¶
type DefaultErrorHandler ¶
type DefaultErrorHandler struct {
// contains filtered or unexported fields
}
func NewDefaultErrorHandler ¶
func NewDefaultErrorHandler(errEncoder khttp.EncodeErrorFunc) *DefaultErrorHandler
func (*DefaultErrorHandler) Wrap ¶
func (e *DefaultErrorHandler) Wrap(f func(w http.ResponseWriter, r *http.Request) error) http.Handler
type ErrorHandler ¶
type HandlerFunc ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.