Documentation ¶
Index ¶
- Constants
- func Api(ctx *context.Context, middleware ...any) http.Handler
- func Feature(config ...func(*Installer)) setup.Feature
- func ListenAndServe(handler http.Handler, config *Config) error
- func New(handler http.Handler, config *Config) *http.Server
- func Use(ctx *context.Context, handler any, middleware ...any) http.Handler
- type Config
- type Handler
- type HandlerFunc
- type Installer
- type Middleware
- type MiddlewareFunc
- type PolyHandler
- type StatusCodeMapper
- func (s *StatusCodeMapper) AccessDenied(_ ..., _ *authorizes.AccessDeniedError, _ *struct{ args.Optional }, ...) int
- func (s *StatusCodeMapper) JsonSyntax(_ ..., _ *json.SyntaxError) int
- func (s *StatusCodeMapper) NotHandled(_ ..., _ *miruken.NotHandledError) int
- func (s *StatusCodeMapper) UnknownTypeId(_ ..., _ *api.UnknownTypeIdError) int
- func (s *StatusCodeMapper) Validation(_ ..., _ *validates.Outcome) int
Constants ¶
const ComposerKey contextKey = 0
ComposerKey is used to access the miruken.Handler from the context.
Variables ¶
This section is empty.
Functions ¶
func Api ¶ added in v0.22.0
Api builds a http.Handler for processing polymorphic api calls through a Middleware pipeline.
func ListenAndServe ¶ added in v0.30.92
ListenAndServe creates and starts a http.Server with the provided configuration.
Types ¶
type Config ¶ added in v0.30.87
type Config struct { Addr string ReadTimeout time.Duration ReadHeaderTimeout time.Duration WriteTimeout time.Duration IdleTimeout time.Duration MaxHeaderBytes int }
Config provides http.Server configuration.
type HandlerFunc ¶ added in v0.30.41
HandlerFunc promotes a function to Handler.
func (HandlerFunc) ServeHTTP ¶ added in v0.30.41
func (f HandlerFunc) ServeHTTP( w http.ResponseWriter, r *http.Request, h miruken.Handler, )
type Middleware ¶ added in v0.30.5
type Middleware interface { ServeHTTP( http.ResponseWriter, *http.Request, miruken.Handler, func(miruken.Handler), ) }
Middleware augments Handler to participate in a pipeline to support pre and post processing of requests.
func M ¶ added in v0.30.46
func M[M any](opts ...any) Middleware
M builds a typed Middleware wrapper for dynamic http processing.
func Pipe ¶ added in v0.30.41
func Pipe(middleware ...any) Middleware
Pipe builds a Middleware chain for pre and post processing of http requests.
type MiddlewareFunc ¶ added in v0.30.5
type MiddlewareFunc func( w http.ResponseWriter, r *http.Request, h miruken.Handler, n func(miruken.Handler), )
MiddlewareFunc promotes a function to Middleware.
type PolyHandler ¶ added in v0.30.46
type PolyHandler struct {
// contains filtered or unexported fields
}
PolyHandler is a Handler for processing polymorphic http requests.
func (*PolyHandler) Constructor ¶ added in v0.30.46
func (a *PolyHandler) Constructor( _ *struct{ args.Optional }, logger logr.Logger, )
func (*PolyHandler) ServeHTTP ¶ added in v0.30.46
func (a *PolyHandler) ServeHTTP( w http.ResponseWriter, r *http.Request, h miruken.Handler, )
type StatusCodeMapper ¶
type StatusCodeMapper struct{}
StatusCodeMapper maps errors into a corresponding http status code.
func (*StatusCodeMapper) AccessDenied ¶ added in v0.30.7
func (s *StatusCodeMapper) AccessDenied( _ *struct { maps.It maps.Format `to:"http:status-code"` }, _ *authorizes.AccessDeniedError, _ *struct{ args.Optional }, subject security.Subject, ) int
func (*StatusCodeMapper) JsonSyntax ¶ added in v0.21.0
func (s *StatusCodeMapper) JsonSyntax( _ *struct { maps.It maps.Format `to:"http:status-code"` }, _ *json.SyntaxError, ) int
func (*StatusCodeMapper) NotHandled ¶ added in v0.21.0
func (s *StatusCodeMapper) NotHandled( _ *struct { maps.It maps.Format `to:"http:status-code"` }, _ *miruken.NotHandledError, ) int
func (*StatusCodeMapper) UnknownTypeId ¶ added in v0.21.0
func (s *StatusCodeMapper) UnknownTypeId( _ *struct { maps.It maps.Format `to:"http:status-code"` }, _ *api.UnknownTypeIdError, ) int