httpserver

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicHandler

func BasicHandler(handler func(request *http.Request) CanHTTPWrite, l *log.Logger) http.Handler

func HealthHandler

func HealthHandler(z *log.Logger, tracer tracing.Tracing) http.Handler

func LogMiddleware

func LogMiddleware(logger *log.Logger, filterFunc func(req *http.Request) bool) func(handler http.Handler) http.Handler

func MuxMiddleware

func MuxMiddleware() func(handler http.Handler) http.Handler

func NotFoundHandler

func NotFoundHandler(logger *log.Logger) http.Handler

Types

type BasicResponse

type BasicResponse struct {
	Code    int
	Msg     io.WriterTo
	Headers map[string]string
}

func (*BasicResponse) HTTPWrite

func (g *BasicResponse) HTTPWrite(ctx context.Context, w http.ResponseWriter, l *log.Logger)

type CanHTTPWrite

type CanHTTPWrite interface {
	HTTPWrite(ctx context.Context, w http.ResponseWriter, l *log.Logger)
}

type JWTSignIn added in v0.0.17

type JWTSignIn struct {
	Logger        *log.Logger
	Auth          func(username string, password string) (bool, error)
	SigningString func(username string) *rsa.PrivateKey
}

func (*JWTSignIn) ServeHTTP added in v0.0.17

func (j *JWTSignIn) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

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