added ErrorsContextKeyName
This commit is contained in:
parent
744cecf61d
commit
b0d46aaec3
@ -9,6 +9,9 @@ import (
|
|||||||
// Using separate type because of the following: https://staticcheck.io/docs/checks#SA1029
|
// Using separate type because of the following: https://staticcheck.io/docs/checks#SA1029
|
||||||
type ClaimsContextKeyName string
|
type ClaimsContextKeyName string
|
||||||
|
|
||||||
|
// ErrosContextKeyName holds the key to pass errors under.
|
||||||
|
type ErrorsContextKeyName string
|
||||||
|
|
||||||
// DefaultClaimsContextKeyName is of type ClaimsContextKeyName and defaults to "claims"
|
// DefaultClaimsContextKeyName is of type ClaimsContextKeyName and defaults to "claims"
|
||||||
const DefaultClaimsContextKeyName ClaimsContextKeyName = "claims"
|
const DefaultClaimsContextKeyName ClaimsContextKeyName = "claims"
|
||||||
|
|
||||||
@ -46,6 +49,7 @@ type Options struct {
|
|||||||
ClaimsContextKeyName ClaimsContextKeyName
|
ClaimsContextKeyName ClaimsContextKeyName
|
||||||
ErrorHandler ErrorHandler
|
ErrorHandler ErrorHandler
|
||||||
Permissive bool
|
Permissive bool
|
||||||
|
ErrorsContextKeyName ErrorsContextKeyName
|
||||||
}
|
}
|
||||||
|
|
||||||
// New takes Option setters and returns an Options pointer.
|
// New takes Option setters and returns an Options pointer.
|
||||||
@ -270,3 +274,11 @@ func WithPermissive() Option {
|
|||||||
opts.Permissive = true
|
opts.Permissive = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithErrorsContextKeyName sets the ErrorsContextKeyName parameter for an Options pointer.
|
||||||
|
// ErrorsContextKeyName is the name of the key that will be used to pass errors using the request context.
|
||||||
|
func WithErrorsContextKeyName(opt string) Option {
|
||||||
|
return func(opts *Options) {
|
||||||
|
opts.ErrorsContextKeyName = ErrorsContextKeyName(opt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user