middle

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryAdaptor

func BinaryAdaptor() midl.Adapter

BinaryAdaptor returns a midl.Adapter instance for responding with application/binary on success and application/json on error.

func ContentLengthFilter

func ContentLengthFilter(bytes bites.ByteSize) midl.Middleware

ContentLengthFilter constructs a middleware filter that enforces the incoming request has a Content-Length header and that the value is below the given threshold.

func JSONContentFilter

func JSONContentFilter() midl.MiddlewareFunc

JSONContentFilter creates a middleware layer that enforces both the existence of the Content-Type header and that the header equals "application/json".

func JobIDValidator

func JobIDValidator(
	tknKey string,
	next midl.Middleware,
) midl.MiddlewareFunc

JobIDValidator is a middleware filter that rejects requests that have invalid jobId url parameters.

func MetricAgg

func MetricAgg(next http.Handler) http.HandlerFunc

MetricAgg is an HTTP handler wrapper that records metrics for the wrapped handler.

func New404Handler

func New404Handler() midl.Middleware

New404Handler constructs a generic handler for requests that have no matching registered route.

func New405Handler

func New405Handler() midl.Middleware

New405Handler constructs a generic handler for requests that have no matching route for the request method (e.g. no handler for POST request to /api).

func RegisterGenericHandlers

func RegisterGenericHandlers(r *mux.Router)

RegisterGenericHandlers appends generic error generators for unroutable requests to the global router.

func RequestCtxProvider

func RequestCtxProvider(next http.Handler) http.HandlerFunc

RequestCtxProvider wraps an HTTP handler and provides additional context to the request and to the server for the request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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