middleware

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 9 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 HeadersFromContext

func HeadersFromContext(ctx context.Context) http.Header

HeadersFromContext 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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