mirror of
https://github.com/kataras/iris.git
synced 2026-01-24 20:35:59 +00:00
add GetDomain and SetCookieKVExpiration patch functions to the iris.Patches
This commit is contained in:
13
aliases.go
13
aliases.go
@@ -6,6 +6,7 @@ import (
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/kataras/iris/v12/cache"
|
||||
"github.com/kataras/iris/v12/context"
|
||||
@@ -792,6 +793,18 @@ func (cp *ContextPatches) Writers() *ContextWriterPatches {
|
||||
return cp.writers
|
||||
}
|
||||
|
||||
// GetDomain modifies the way a domain is fetched from `Context#Domain` method,
|
||||
// which is used on subdomain redirect feature, i18n's language cookie for subdomain sharing
|
||||
// and the rewrite middleware.
|
||||
func (cp *ContextPatches) GetDomain(patchFunc func(hostport string) string) {
|
||||
context.GetDomain = patchFunc
|
||||
}
|
||||
|
||||
// SetCookieKVExpiration modifies the default cookie expiration time on `Context#SetCookieKV` method.
|
||||
func (cp *ContextPatches) SetCookieKVExpiration(patch time.Duration) {
|
||||
context.SetCookieKVExpiration = patch
|
||||
}
|
||||
|
||||
// ContextWriterPatches features the context's writers patches.
|
||||
type ContextWriterPatches struct{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user