mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
Update to 4.4.3
This commit is contained in:
parent
ff3d1d4c8a
commit
78f3323ce4
|
@ -2,6 +2,11 @@
|
|||
|
||||
**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`.
|
||||
|
||||
## 4.4.1 -> 4.4.3
|
||||
|
||||
- **FIX**: CORS
|
||||
- **FIX**: Unexpected Party root's route slash when `DisablePathCorrection` is false(default), as reported [here](https://github.com/kataras/iris/issues/453)
|
||||
|
||||
## 4.4.0 -> 4.4.1
|
||||
|
||||
- **NEW**: Template PreRenders, as requested [here](https://github.com/kataras/iris/issues/412).
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<br/>
|
||||
|
||||
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.4.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-%204.4.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>
|
||||
|
||||
|
@ -222,7 +222,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
|
|||
Versioning
|
||||
------------
|
||||
|
||||
Current: **v4.4.2**
|
||||
Current: **v4.4.3**
|
||||
|
||||
> Iris is an active project
|
||||
|
||||
|
@ -258,7 +258,7 @@ This project is licensed under the [MIT License](LICENSE), Copyright (c) 2016 Ge
|
|||
[Travis]: http://travis-ci.org/kataras/iris
|
||||
[License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square
|
||||
[License]: https://github.com/kataras/iris/blob/master/LICENSE
|
||||
[Release Widget]: https://img.shields.io/badge/release-4.4.2%20-blue.svg?style=flat-square
|
||||
[Release Widget]: https://img.shields.io/badge/release-4.4.3%20-blue.svg?style=flat-square
|
||||
[Release]: https://github.com/kataras/iris/releases
|
||||
[Chat Widget]: https://img.shields.io/badge/community-chat%20-00BCD4.svg?style=flat-square
|
||||
[Chat]: https://kataras.rocket.chat/channel/iris
|
||||
|
|
|
@ -8,12 +8,13 @@ CONTRIBUTE & DISCUSSION ABOUT TESTS TO: https://github.com/iris-contrib/tests
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/valyala/fasthttp"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"github.com/gavv/httpexpect"
|
||||
)
|
||||
|
||||
|
@ -408,7 +409,7 @@ func TestMuxSimpleParty(t *testing.T) {
|
|||
}
|
||||
|
||||
Default.Config.VHost = "0.0.0.0:8080"
|
||||
//Default.Config.Tester.Debug = true
|
||||
Default.Config.Tester.Debug = true
|
||||
//Default.Config.Tester.ExplicitURL = true
|
||||
e := Tester(t)
|
||||
|
||||
|
@ -420,7 +421,7 @@ func TestMuxSimpleParty(t *testing.T) {
|
|||
}
|
||||
|
||||
// run the tests
|
||||
request("/party1/")
|
||||
request("/party1")
|
||||
request("/party1/path1")
|
||||
request("/party1/path2")
|
||||
request("/party1/namedpath/theparam1/something/theparam2")
|
||||
|
|
40
iris.go
40
iris.go
|
@ -52,15 +52,6 @@ package iris // import "github.com/kataras/iris"
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gavv/httpexpect"
|
||||
"github.com/kataras/go-errors"
|
||||
"github.com/kataras/go-fs"
|
||||
"github.com/kataras/go-serializer"
|
||||
"github.com/kataras/go-sessions"
|
||||
"github.com/kataras/go-template"
|
||||
"github.com/kataras/go-template/html"
|
||||
"github.com/kataras/iris/utils"
|
||||
"github.com/valyala/fasthttp"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -75,11 +66,21 @@ import (
|
|||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gavv/httpexpect"
|
||||
"github.com/kataras/go-errors"
|
||||
"github.com/kataras/go-fs"
|
||||
"github.com/kataras/go-serializer"
|
||||
"github.com/kataras/go-sessions"
|
||||
"github.com/kataras/go-template"
|
||||
"github.com/kataras/go-template/html"
|
||||
"github.com/kataras/iris/utils"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
const (
|
||||
// Version is the current version of the Iris web framework
|
||||
Version = "4.4.2"
|
||||
Version = "4.4.3"
|
||||
|
||||
banner = ` _____ _
|
||||
|_ _| (_)
|
||||
|
@ -240,6 +241,9 @@ func New(setters ...OptionSetter) *Framework {
|
|||
{
|
||||
// set the servemux, which will provide us the public API also, with its context pool
|
||||
mux := newServeMux(s.Logger)
|
||||
mux.escapePath = !s.Config.DisablePathCorrection
|
||||
// escapePath re-setted on .Set and after build, it's the only config which should be setted before any other route(party-releated) method called.
|
||||
|
||||
mux.onLookup = s.Plugins.DoPreLookup
|
||||
s.contextPool.New = func() interface{} {
|
||||
return &Context{framework: s}
|
||||
|
@ -267,6 +271,10 @@ func (s *Framework) Set(setters ...OptionSetter) {
|
|||
for _, setter := range setters {
|
||||
setter.Set(s.Config)
|
||||
}
|
||||
|
||||
if s.muxAPI != nil && s.mux != nil { // if called after .New
|
||||
s.mux.escapePath = !s.Config.DisablePathCorrection // then re-set the mux' pathEscape, which should be setted BEFORE any route-releated method call
|
||||
}
|
||||
}
|
||||
|
||||
// Must panics on error, it panics on registed iris' logger
|
||||
|
@ -1328,7 +1336,7 @@ func (api *muxAPI) Handle(method string, registedPath string, handlers ...Handle
|
|||
return nil
|
||||
}
|
||||
|
||||
fullpath := api.relativePath + registedPath // keep the last "/" if any, "/xyz/"
|
||||
fullpath := api.relativePath + registedPath // for now, keep the last "/" if any, "/xyz/"
|
||||
|
||||
middleware := joinMiddleware(api.middleware, handlers)
|
||||
|
||||
|
@ -1340,6 +1348,16 @@ func (api *muxAPI) Handle(method string, registedPath string, handlers ...Handle
|
|||
subdomain = fullpath[0 : dotWSlashIdx+1] // admin.
|
||||
path = fullpath[dotWSlashIdx+1:] // /
|
||||
}
|
||||
// we splitted the path and subdomain parts so we're ready to check only the path, otherwise we will had problems with subdomains
|
||||
if api.mux.correctPath {
|
||||
// remove last "/" if any, "/xyz/"
|
||||
if len(path) > 1 { // if it's the root, then keep it*
|
||||
if path[len(path)-1] == slashByte {
|
||||
// ok we are inside /xyz/
|
||||
path = path[0 : len(path)-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
path = strings.Replace(path, "//", "/", -1) // fix the path if double //
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user