middleware

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultCORSConfig defeault config for cors
	DefaultCORSConfig = CorsConfig{
		AllowOrigins: []string{"*"},
		AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete},
	}
)

Functions

func Compress

func Compress() func(ctx *slide.Ctx) error

Compress brotli compression

func Cors added in v1.1.9

func Cors() func(ctx *slide.Ctx) error

Cors Middleware with default config Reference https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

func CorsWithConfig added in v1.1.9

func CorsWithConfig(config CorsConfig) func(ctx *slide.Ctx) error

CorsWithConfig Cors with a config

Types

type CorsConfig added in v1.1.9

type CorsConfig struct {
	AllowMethods     []string
	AllowOrigins     []string
	AllowHeaders     []string
	AllowCredentials bool
	ExposeHeaders    []string
	MaxAge           int
}

CorsConfig configuration for Corsfeat

Jump to

Keyboard shortcuts

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