middleware

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowCORS

func AllowCORS() gin.HandlerFunc

func GetHubFromContext added in v1.0.3

func GetHubFromContext(ctx *gin.Context) *sentry.Hub

GetHubFromContext retrieves attached *sentry.Hub instance from gin.Context.

func New added in v1.0.3

func New(options Options) gin.HandlerFunc

New returns a function that satisfies gin.HandlerFunc interface It can be used with Use() methods.

func PanicLogger

func PanicLogger() gin.HandlerFunc

func RecoveryWithWriter

func RecoveryWithWriter(out io.Writer) gin.HandlerFunc

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

func SentryRecover added in v1.0.3

func SentryRecover(isUseSentry bool) gin.HandlerFunc

Types

type Options added in v1.0.3

type Options struct {
	// Repanic configures whether Sentry should repanic after recovery, in most cases it should be set to true,
	// as gin.Default includes it's own Recovery middleware what handles http responses.
	Repanic bool
	// WaitForDelivery configures whether you want to block the request before moving forward with the response.
	// Because Gin's default Recovery handler doesn't restart the application,
	// it's safe to either skip this option or set it to false.
	WaitForDelivery bool
	// Timeout for the event delivery requests.
	Timeout time.Duration
}

Jump to

Keyboard shortcuts

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