mux

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redirect

func Redirect(url string) *httpbody.HttpBody

Redirect response http body with redirect

Types

type MuxOption

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

MuxOption

type MuxServe

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

MuxServe the custom serve mux that implement grpc MuxServe to simplify the http restful.

func NewMuxServe

func NewMuxServe(logger *zap.Logger, opts ...Optional) *MuxServe

NewMuxServe allocates and returns a new MuxServe.

func (*MuxServe) Handle

func (srv *MuxServe) Handle(method, path string, h runtime.HandlerFunc)

Handle handle http path

func (*MuxServe) ServeHTTP

func (srv *MuxServe) ServeHTTP(w http.ResponseWriter, r *http.Request)

Handle handle http path

func (*MuxServe) ServeMux

func (srv *MuxServe) ServeMux() *runtime.ServeMux

ServeMux return grpc gateway server mux

type Optional

type Optional func(*MuxOption)

Optional the Options for this module

func WithAuthFunc added in v0.2.18

func WithAuthFunc(a interceptor.Authorize) Optional

WithAuthFunc

func WithBodyMarshaler

func WithBodyMarshaler(ms runtime.Marshaler) Optional

WithBodyMarshaler

func WithBodyWriter

func WithBodyWriter(b rewriter.BodyReWriterFunc) Optional

WithBodyWriter

func WithErrorHandler

func WithErrorHandler(fn runtime.ErrorHandlerFunc) Optional

WithErrorHandler

func WithErrorMarshaler

func WithErrorMarshaler(ms runtime.Marshaler) Optional

WithErrorMarshaler

func WithLimiter added in v0.2.18

func WithLimiter(l *limit.Limiter) Optional

WithLimiter performs rate limiting on the request.

func WithMiddleWares

func WithMiddleWares(middleWares ...middleware.MuxMiddleware) Optional

WithMiddleWares pluggable function that performs middle wares.

func WithRunTimeOpts

func WithRunTimeOpts(opts runtime.ServeMuxOption) Optional

WithRunTimeOpts with runtime MuxOption

func WithTracer

func WithTracer(tracer opentracing.Tracer) Optional

WithTracer

func WithoutHTTPStatus

func WithoutHTTPStatus() Optional

WithoutHTTPStatus pluggable function that performs if use http status on response.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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