From 5bc07965482e57fcae5a8e506db592527b264102 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Wed, 21 Sep 2022 22:21:14 +0300 Subject: [PATCH] add GetDomain and SetCookieKVExpiration patch functions to the iris.Patches --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- README.md | 2 +- README_FA.md | 2 +- _examples/response-writer/json-third-party/go.mod | 4 +--- _examples/response-writer/json-third-party/go.sum | 2 ++ aliases.go | 13 +++++++++++++ doc.go | 2 +- iris.go | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e9d1b509..0ee4de11 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem. - OS: [e.g. ubuntu, windows] **iris.Version** -- e.g. v12.2.0-beta4 or master +- e.g. v12.2.0-beta5 or master Please make sure the bug is reproducible over the `master` branch: diff --git a/README.md b/README.md index 1f1fc2b2..d5e449d5 100644 --- a/README.md +++ b/README.md @@ -462,7 +462,7 @@ With your help, we can improve Open Source web development for everyone! $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@master # or @v12.2.0-beta4 +$ go get github.com/kataras/iris/v12@master # or @v12.2.0-beta5 ```
Install on existing project diff --git a/README_FA.md b/README_FA.md index f51000a7..261b0439 100644 --- a/README_FA.md +++ b/README_FA.md @@ -242,7 +242,7 @@ Venkatt Guhesan" title="vguhesan" with="75" style="width:75px;max-width:75px;hei $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@master # or @v12.2.0-beta4 +$ go get github.com/kataras/iris/v12@master # or @v12.2.0-beta5 ```
diff --git a/_examples/response-writer/json-third-party/go.mod b/_examples/response-writer/json-third-party/go.mod index 739560f7..a4cec8e9 100644 --- a/_examples/response-writer/json-third-party/go.mod +++ b/_examples/response-writer/json-third-party/go.mod @@ -2,11 +2,9 @@ module github.com/kataras/iris/v12/_examples/response-writer/json-third-party go 1.19 -replace github.com/kataras/iris/v12 => ../../../ - require ( github.com/bytedance/sonic v1.5.0 - github.com/kataras/iris/v12 v12.2.0-beta4.0.20220920072528-ff81f370625a + github.com/kataras/iris/v12 v12.2.0-beta4.0.20220920150839-0a4927f6df85 ) require ( diff --git a/_examples/response-writer/json-third-party/go.sum b/_examples/response-writer/json-third-party/go.sum index f3e4ed4f..7ea78e5c 100644 --- a/_examples/response-writer/json-third-party/go.sum +++ b/_examples/response-writer/json-third-party/go.sum @@ -55,6 +55,8 @@ github.com/kataras/blocks v0.0.6 h1:UQI+2AMxhUoe5WcyAT0AdPHTSMcrPy+ALAgvYj2vPwo= github.com/kataras/blocks v0.0.6/go.mod h1:UK+Iwk0Oxpc0GdoJja7sEildotAUKK1LYeYcVF0COWc= github.com/kataras/golog v0.1.7 h1:0TY5tHn5L5DlRIikepcaRR/6oInIr9AiWsxzt0vvlBE= github.com/kataras/golog v0.1.7/go.mod h1:jOSQ+C5fUqsNSwurB/oAHq1IFSb0KI3l6GMa7xB6dZA= +github.com/kataras/iris/v12 v12.2.0-beta4.0.20220920150839-0a4927f6df85 h1:vnIO2SA6Q4ZEH9tXGkk3F4UhVlJDqB4PgH5tZW/JaAA= +github.com/kataras/iris/v12 v12.2.0-beta4.0.20220920150839-0a4927f6df85/go.mod h1:q26aoWJ0Knx/00iPKg5iizDK7oQQSPjbD8np0XDh6dc= github.com/kataras/pio v0.0.10/go.mod h1:gS3ui9xSD+lAUpbYnjOGiQyY7sUMJO+EHpiRzhtZ5no= github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= diff --git a/aliases.go b/aliases.go index b80a3065..b4f671d9 100644 --- a/aliases.go +++ b/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{} diff --git a/doc.go b/doc.go index 2e430d42..1ab7bec5 100644 --- a/doc.go +++ b/doc.go @@ -38,7 +38,7 @@ Source code and other details for the project are available at GitHub: # Current Version -12.2.0-beta4 +12.2.0-beta5 # Installation diff --git a/iris.go b/iris.go index cdbed278..cec233bc 100644 --- a/iris.go +++ b/iris.go @@ -39,7 +39,7 @@ import ( ) // Version is the current version of the Iris Web Framework. -const Version = "12.2.0-beta4" +const Version = "12.2.0-beta5" // Byte unit helpers. const (