httpsrv

package
v0.30.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Api added in v0.22.0

func Api(
	h miruken.Handler,
	middleware ...Middleware,
) http.Handler

Api builds a http.Handler for accepting polymorphic api calls through a Middleware pipeline.

func Dispatch added in v0.30.41

func Dispatch(
	h miruken.Handler,
	handler Handler,
	middleware ...Middleware,
) http.Handler

Dispatch builds an enhanced http.Handler for processing requests through a Middleware pipeline and terminating at a Handler.

func DispatchFunc added in v0.30.41

func DispatchFunc(
	h miruken.Handler,
	handler func(http.ResponseWriter, *http.Request, miruken.Handler),
	middleware ...Middleware,
) http.Handler

DispatchFunc builds an enhanced http.Handler for processing requests through a Middleware pipeline and terminating at a handler function.

func DispatchTo added in v0.30.41

func DispatchTo[H Handler](
	h miruken.Handler,
	middleware ...Middleware,
) http.Handler

DispatchTo builds an enhanced http.Handler for processing requests through a Middleware pipeline and terminating at a typed Handler.

func Feature

func Feature(config ...func(*Installer)) miruken.Feature

Feature configures http server support

Types

type ApiHandler added in v0.26.0

type ApiHandler struct {
	// contains filtered or unexported fields
}

ApiHandler is a http.Handler for processing api requests over http.

func (*ApiHandler) Constructor added in v0.26.0

func (a *ApiHandler) Constructor(
	_ *struct{ args.Optional }, logger logr.Logger,
)

func (*ApiHandler) ServeHTTP added in v0.26.0

func (a *ApiHandler) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
	h miruken.Handler,
)

type Handler added in v0.26.0

type Handler interface {
	ServeHTTP(
		w http.ResponseWriter,
		r *http.Request,
		h miruken.Handler,
	)
}

Handler augments http.Handler to provide miruken.Handler composer.

type HandlerFunc added in v0.30.41

type HandlerFunc func(
	w http.ResponseWriter,
	r *http.Request,
	h miruken.Handler,
)

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 Installer

type Installer struct{}

Installer configures http server support

func (*Installer) DependsOn

func (i *Installer) DependsOn() []miruken.Feature

func (*Installer) Install

func (i *Installer) Install(setup *miruken.SetupBuilder) error

type Middleware added in v0.30.5

type Middleware interface {
	ServeHTTP(
		Middleware,
		http.ResponseWriter,
		*http.Request,
		Middleware,
		miruken.Handler,
		func(miruken.Handler),
	)
}

Middleware augments Handler to participate in a pipeline to support pre and post processing of requests.

func Pipe added in v0.30.41

func Pipe(middleware ...Middleware) Middleware

Pipe builds a Middleware chain for pre and post processing of requests.

type MiddlewareAdapter added in v0.30.43

type MiddlewareAdapter struct{}

MiddlewareAdapter is an adapter for implementing Middleware using late binding method resolution.

func (MiddlewareAdapter) ServeHTTP added in v0.30.43

type MiddlewareFunc added in v0.30.5

type MiddlewareFunc func(
	s Middleware,
	w http.ResponseWriter,
	r *http.Request,
	m Middleware,
	h miruken.Handler,
	n func(miruken.Handler),
)

MiddlewareFunc promotes a function to Middleware.

func (MiddlewareFunc) ServeHTTP added in v0.30.5

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

func (*StatusCodeMapper) Validation added in v0.21.0

func (s *StatusCodeMapper) Validation(
	_ *struct {
		maps.It
		maps.Format `to:"http:status-code"`
	}, _ *validates.Outcome,
) int

Directories

Path Synopsis
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL