middleware

package
v1.0.2-0...-46d4d79 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetMethod     = "GET"
	PostMethod    = "POST"
	PutMethod     = "PUT"
	DeleteMethod  = "DELETE"
	OptionsMethod = "OPTIONS"
	PatchMethod   = "PATCH"
	HeadMethod    = "HEAD"
)

HTTP Methods

View Source
const (
	ContentType    = "Content-Type"
	ContentLength  = "Content-Length"
	AcceptEncoding = "Accept-Encoding"
	XCSRFToken     = "X-CSRF-Token"
	Authorization  = "Authorization"
	Accept         = "Accept"
	Origin         = "Origin"
	CacheControl   = "Cache-Control"
	XRequestedWith = "X-Requested-With"
)

HTTP Headers

Variables

This section is empty.

Functions

func AuthToken

func AuthToken(redisConn *redis.Redis) func(http.Handler) http.Handler

func CorsHandler

func CorsHandler(options Options) func(http.Handler) http.Handler

CorsHandler for setting headers on every managed request

Types

type ApiResponse

type ApiResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type Options

type Options struct {
	AllowOrigins     []string
	AllowHeaders     []string
	AllowMethods     []string
	AllowCredentials bool
}

Options for Handler

Jump to

Keyboard shortcuts

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