middleware

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyAuth

func APIKeyAuth(key string, h http.Handler) http.Handler

APIKeyAuth middleware authorizes request using API key authorization. It first tries to use Authorization header to extract API key (Authorization: apikey <KEY>), then checks for api_key URL query parameter. If key not found or invalid then 401 response code is returned.

func CORS

func CORS(originCheck OriginCheck, h http.Handler) http.Handler

CORS middleware.

func ConnLimit added in v4.0.1

func ConnLimit(node *centrifuge.Node, ruleContainer *rule.Container, h http.Handler) http.Handler

func Get

func Get(h http.Handler) http.Handler

Get checks that handler called via GET HTTP method.

func GetHeadersFromContext

func GetHeadersFromContext(ctx context.Context) (http.Header, bool)

GetHeadersFromContext returns http.Header from context.

func HeadersToContext

func HeadersToContext(enable bool, h http.Handler) http.Handler

HeadersToContext puts HTTP headers to request context.

func LogRequest

func LogRequest(h http.Handler) http.Handler

LogRequest middleware logs details of request.

func Post

func Post(h http.Handler) http.Handler

Post checks that handler called via POST HTTP method.

func SetHeadersToContext

func SetHeadersToContext(ctx context.Context, h http.Header) context.Context

Types

type OriginCheck

type OriginCheck func(r *http.Request) bool

Jump to

Keyboard shortcuts

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