httpsrv

package
v0.30.9 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

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

Feature configures http server support

func Pipeline added in v0.30.5

func Pipeline(
	handler miruken.Handler,
	middleware ...Middleware,
) http.Handler

Pipeline returns a http.Handler for processing api calls through a list of Middleware components.

Types

type ApiHandler added in v0.26.0

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

ApiHandler is an 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 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(
		w http.ResponseWriter,
		r *http.Request,
		h miruken.Handler,
		m Middleware,
		n func(miruken.Handler),
	)
}

Middleware extends http.Handler to include a request scoped context.

type MiddlewareFunc added in v0.30.5

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

MiddlewareFunc promotes a function to Middleware.

func (MiddlewareFunc) ServeHTTP added in v0.30.5

func (f MiddlewareFunc) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
	h miruken.Handler,
	m Middleware,
	n func(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,
) 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