middleware

package
v0.0.0-...-625d9dc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package middleware contains http.Handler functions

Index

Constants

View Source
const (

	// XRequestIDHeader header name.
	XRequestIDHeader string = "X-Request-Id"
	// JWTCookieName session cookie name.
	JWTCookieName string = "plantbook_token"
)

Variables

This section is empty.

Functions

func GetCookie

func GetCookie(r *http.Request) (*http.Cookie, error)

GetCookie extracts session cookie from http.Requiest.

func GetRequestID

func GetRequestID(r *http.Request) string

GetRequestID extracts X-Request-Id value from htt.Request.Header.

func RequestID

func RequestID(ctx context.Context, next http.Handler) http.Handler

RequestID middlware which adds random X-Request-Id header if it not exists.

func SetupHandler

func SetupHandler(handler http.Handler) http.Handler

SetupHandler enable CORS, handler metrics.

Types

This section is empty.

Jump to

Keyboard shortcuts

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