middleware

package
v0.0.0-...-98d4610 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerMiddlewares = []func(ctx *fasthttp.RequestCtx, handler func(ctx *fasthttp.RequestCtx) (resp interface{}, err error)) (resp interface{}, err error){
	LoggerServerMiddleware,
	ResponseServerMiddleware,
	HeadersServerMiddleware,
	TimeoutServerMiddleware,
}

Functions

func ErrorClientMiddleware

func ErrorClientMiddleware(
	ctx context.Context,
	req *fasthttp.Request,
	next func(ctx context.Context, req *fasthttp.Request) (resp *fasthttp.Response, err error),
) (resp *fasthttp.Response, err error)

ErrorClientMiddleware checks http response code for error

func HeadersClientMiddleware

func HeadersClientMiddleware(
	ctx context.Context,
	req *fasthttp.Request,
	next func(ctx context.Context, req *fasthttp.Request) (resp *fasthttp.Response, err error),
) (resp *fasthttp.Response, err error)

HeadersClientMiddleware checks and sets headers for client

func HeadersServerMiddleware

func HeadersServerMiddleware(
	ctx *fasthttp.RequestCtx,
	next func(ctx *fasthttp.RequestCtx) (resp interface{}, err error),
) (resp interface{}, err error)

HeadersServerMiddleware checks and sets headers for server

func LoggerClientMiddleware

func LoggerClientMiddleware(
	ctx context.Context,
	req *fasthttp.Request,
	next func(ctx context.Context, req *fasthttp.Request) (resp *fasthttp.Response, err error),
) (resp *fasthttp.Response, err error)

LoggerClientMiddleware logs request and response for client

func LoggerServerMiddleware

func LoggerServerMiddleware(
	ctx *fasthttp.RequestCtx,
	next func(ctx *fasthttp.RequestCtx) (resp interface{}, err error),
) (resp interface{}, err error)

LoggerServerMiddleware logs request and response for server

func ResponseServerMiddleware

func ResponseServerMiddleware(
	ctx *fasthttp.RequestCtx,
	next func(ctx *fasthttp.RequestCtx) (resp interface{}, err error),
) (resp interface{}, err error)

ResponseServerMiddleware format response for server

func TimeoutClientMiddleware

func TimeoutClientMiddleware(
	ctx context.Context,
	req *fasthttp.Request,
	next func(ctx context.Context, req *fasthttp.Request) (resp *fasthttp.Response, err error),
) (resp *fasthttp.Response, err error)

TimeoutClientMiddleware sets timeout for request

func TimeoutServerMiddleware

func TimeoutServerMiddleware(
	ctx *fasthttp.RequestCtx,
	next func(ctx *fasthttp.RequestCtx) (resp interface{}, err error),
) (resp interface{}, err error)

TimeoutServerMiddleware sets timeout for request

Types

This section is empty.

Jump to

Keyboard shortcuts

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