middleware

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinCors

func GinCors(
	cs *GinCorsConfig,
) gin.HandlerFunc

GinCors sets Access-Control-XXXXX header. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

func GinHTTPLogger

func GinHTTPLogger(
	l *logger.Logger,
	traceIDHeader string,
	clientIPHeader string,
) gin.HandlerFunc

GinHTTPLogger retrieves the request/response logs.

Types

type GinCorsConfig

type GinCorsConfig struct {
	AllowAllOrigins bool
	// for Access-Control-Allow-Origin
	AllowOrigins []string
	// for Access-Control-Allow-Methods
	AllowMethods []string
	// for Access-Control-Allow-Headers
	AllowHeaders []string
	// for Access-Control-Allow-Credentials
	AllowCredentials bool
	// for Access-Control-Expose-Headers
	ExposeHeaders []string
	// for Access-Control-Max-Age
	MaxAge time.Duration
}

GinCorsConfig sets configurations.

func DefaultConfig

func DefaultConfig() *GinCorsConfig

DefaultConfig returns a generic default configuration mapped to localhost.

Jump to

Keyboard shortcuts

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