mirror of
https://github.com/kataras/iris.git
synced 2026-01-24 20:35:59 +00:00
add Context.SetVersion helper
Former-commit-id: 605d6c1e78f73b8f2c89bd2dc7ee23f21551d47b
This commit is contained in:
@@ -424,7 +424,9 @@ type Context interface {
|
||||
// See `GetLocale` too.
|
||||
// Example: https://github.com/kataras/iris/tree/master/_examples/i18n
|
||||
Tr(format string, args ...interface{}) string
|
||||
|
||||
// SetVersion force-sets the API Version integrated with the "iris/versioning" subpackage.
|
||||
// It can be used inside a middleare.
|
||||
SetVersion(constraint string)
|
||||
// +------------------------------------------------------------+
|
||||
// | Headers helpers |
|
||||
// +------------------------------------------------------------+
|
||||
@@ -2025,6 +2027,12 @@ func (ctx *context) Tr(format string, args ...interface{}) string { // other nam
|
||||
return fmt.Sprintf(format, args...)
|
||||
}
|
||||
|
||||
// SetVersion force-sets the API Version integrated with the "iris/versioning" subpackage.
|
||||
// It can be used inside a middleare.
|
||||
func (ctx *context) SetVersion(constraint string) {
|
||||
ctx.Values().Set(ctx.Application().ConfigurationReadOnly().GetVersionContextKey(), constraint)
|
||||
}
|
||||
|
||||
// +------------------------------------------------------------+
|
||||
// | Response Headers helpers |
|
||||
// +------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user