middleware

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeyHttpRequest = "HttpRequest"
	KeyRequestID   = "RequestID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMiddleware

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

func (*BaseMiddleware) Handle

func (mw *BaseMiddleware) Handle(ctx droplet.Context) error

func (*BaseMiddleware) SetNext

func (mw *BaseMiddleware) SetNext(next droplet.Middleware)

type HttpInfoInjectorMiddleware

type HttpInfoInjectorMiddleware struct {
	BaseMiddleware
	// contains filtered or unexported fields
}

func (*HttpInfoInjectorMiddleware) Handle

type HttpInfoInjectorOption

type HttpInfoInjectorOption struct {
	ReqFunc func() *http.Request
}

type HttpInputMiddleware

type HttpInputMiddleware struct {
	BaseMiddleware
	// contains filtered or unexported fields
}

func NewHttpInputMiddleWare

func NewHttpInputMiddleWare(opt HttpInputOption) *HttpInputMiddleware

func (*HttpInputMiddleware) Handle

func (mw *HttpInputMiddleware) Handle(ctx droplet.Context) error

type HttpInputOption

type HttpInputOption struct {
	PathParamsFunc func(key string) string
	InputType      reflect.Type
	IsReadFromBody bool
}

type HttpRespReshapeMiddleware

type HttpRespReshapeMiddleware struct {
	BaseMiddleware
}

func NewRespReshapeMiddleware

func NewRespReshapeMiddleware() *HttpRespReshapeMiddleware

func (*HttpRespReshapeMiddleware) Handle

type TrafficLog

type TrafficLog struct {
	RequestID   string      `json:"request_id,omitempty"`
	Path        string      `json:"path,omitempty"`
	Method      string      `json:"method,omitempty"`
	ElapsedTime int64       `json:"elapsed_time,omitempty"`
	Input       interface{} `json:"request,omitempty"`
	Output      interface{} `json:"response,omitempty"`
	Error       error       `json:"error,omitempty"`
}

type TrafficLogMiddleware

type TrafficLogMiddleware struct {
	BaseMiddleware
	// contains filtered or unexported fields
}

func NewTrafficLogMiddleware

func NewTrafficLogMiddleware(opt TrafficLogOpt) *TrafficLogMiddleware

func (*TrafficLogMiddleware) Handle

func (mw *TrafficLogMiddleware) Handle(ctx droplet.Context) error

type TrafficLogOpt

type TrafficLogOpt struct {
	IsLogReqAndResp bool
	LogFunc         func(log *TrafficLog)
}

Jump to

Keyboard shortcuts

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