add GetDomain and SetCookieKVExpiration patch functions to the iris.Patches

This commit is contained in:
Gerasimos (Makis) Maropoulos 2022-09-21 22:21:14 +03:00
parent 0a4927f6df
commit 5bc0796548
No known key found for this signature in database
GPG Key ID: 403EEB7885C79503
8 changed files with 21 additions and 8 deletions

View File

@ -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:

View File

@ -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
```
<details><summary>Install on existing project</summary>

View File

@ -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
```
<div dir="rtl">

View File

@ -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 (

View File

@ -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=

View File

@ -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{}

2
doc.go
View File

@ -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

View File

@ -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 (