mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
Fix an old issue https://github.com/kataras/iris/issues/355
This commit is contained in:
parent
163817bec4
commit
619a54a9f2
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
|
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
|
||||||
|
|
||||||
|
## 5.0.2 -> 5.0.3
|
||||||
|
|
||||||
|
- Fix `https relative redirect paths`, a very old issue, which I just saw, peaceful, again :)
|
||||||
|
|
||||||
## 5.0.1 -> 5.0.2
|
## 5.0.1 -> 5.0.2
|
||||||
|
|
||||||
- [geekypanda/httpcache](https://github.com/geekypanda/httpcache) has been re-written,
|
- [geekypanda/httpcache](https://github.com/geekypanda/httpcache) has been re-written,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%205.0.2%20-blue.svg?style=flat-square" alt="Releases"></a>
|
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%205.0.3%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||||
|
|
||||||
<a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a>
|
<a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a>
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
|
||||||
Versioning
|
Versioning
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Current: **v5.0.2**
|
Current: **v5.0.3**
|
||||||
|
|
||||||
Stable: **[v4 LTS](https://github.com/kataras/iris/tree/4.0.0#versioning)**
|
Stable: **[v4 LTS](https://github.com/kataras/iris/tree/4.0.0#versioning)**
|
||||||
|
|
||||||
|
|
19
context.go
19
context.go
|
@ -474,28 +474,29 @@ func (ctx *Context) SetHeader(k string, v string) {
|
||||||
// Redirect redirect sends a redirect response the client
|
// Redirect redirect sends a redirect response the client
|
||||||
// accepts 2 parameters string and an optional int
|
// accepts 2 parameters string and an optional int
|
||||||
// first parameter is the url to redirect
|
// first parameter is the url to redirect
|
||||||
// second parameter is the http status should send, default is 302 (StatusFound), you can set it to 301 (Permant redirect), if that's nessecery
|
// second parameter is the http status should send, default is 302 (StatusFound),
|
||||||
|
// you can set it to 301 (Permant redirect), if that's nessecery
|
||||||
func (ctx *Context) Redirect(urlToRedirect string, statusHeader ...int) {
|
func (ctx *Context) Redirect(urlToRedirect string, statusHeader ...int) {
|
||||||
|
ctx.StopExecution()
|
||||||
|
|
||||||
httpStatus := StatusFound // a 'temporary-redirect-like' which works better than for our purpose
|
httpStatus := StatusFound // a 'temporary-redirect-like' which works better than for our purpose
|
||||||
if statusHeader != nil && len(statusHeader) > 0 && statusHeader[0] > 0 {
|
if statusHeader != nil && len(statusHeader) > 0 && statusHeader[0] > 0 {
|
||||||
httpStatus = statusHeader[0]
|
httpStatus = statusHeader[0]
|
||||||
}
|
}
|
||||||
ctx.RequestCtx.Redirect(urlToRedirect, httpStatus)
|
|
||||||
|
|
||||||
/* you can use one of these if you want to customize the redirection:
|
// #355
|
||||||
1.
|
if ctx.IsTLS() {
|
||||||
u := fasthttp.AcquireURI()
|
u := fasthttp.AcquireURI()
|
||||||
ctx.URI().CopyTo(u)
|
ctx.URI().CopyTo(u)
|
||||||
|
u.SetScheme("https")
|
||||||
u.Update(urlToRedirect)
|
u.Update(urlToRedirect)
|
||||||
ctx.SetHeader("Location", string(u.FullURI()))
|
ctx.SetHeader("Location", string(u.FullURI()))
|
||||||
fasthttp.ReleaseURI(u)
|
fasthttp.ReleaseURI(u)
|
||||||
ctx.SetStatusCode(httpStatus)
|
ctx.SetStatusCode(httpStatus)
|
||||||
2.
|
return
|
||||||
ctx.SetHeader("Location", urlToRedirect)
|
}
|
||||||
ctx.SetStatusCode(httpStatus)
|
|
||||||
*/
|
|
||||||
|
|
||||||
ctx.StopExecution()
|
ctx.RequestCtx.Redirect(urlToRedirect, httpStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RedirectTo does the same thing as Redirect but instead of receiving a uri or path it receives a route name
|
// RedirectTo does the same thing as Redirect but instead of receiving a uri or path it receives a route name
|
||||||
|
|
2
iris.go
2
iris.go
|
@ -80,7 +80,7 @@ const (
|
||||||
// IsLongTermSupport flag is true when the below version number is a long-term-support version
|
// IsLongTermSupport flag is true when the below version number is a long-term-support version
|
||||||
IsLongTermSupport = false
|
IsLongTermSupport = false
|
||||||
// Version is the current version number of the Iris web framework
|
// Version is the current version number of the Iris web framework
|
||||||
Version = "5.0.2"
|
Version = "5.0.3"
|
||||||
|
|
||||||
banner = ` _____ _
|
banner = ` _____ _
|
||||||
|_ _| (_)
|
|_ _| (_)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user