mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 04:21:57 +00:00
This commit is contained in:
@@ -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`.
|
||||
|
||||
## 6.0.1 -> 6.0.2
|
||||
|
||||
- Fix subdomains (silly fix by checking the Request.Host vs Request.URL.Host) and add a more realistic test, as reported [here](https://github.com/kataras/iris/issues/574).
|
||||
|
||||
|
||||
## 6.0.0 -> 6.0.1
|
||||
|
||||
We had(for 2 days) one ResponseWriter which has special and unique features, but it slowed the execution a little bit, so I had to think more about it, I want to keep iris as the fastest http/2 web framework, well-designed and also to be usable and very easy for new programmers, performance vs design is tough decision. I choose performance most of the times but golang gives us the way to have a good design with that too.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<br/>
|
||||
|
||||
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%206.0.1%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-%206.0.2%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>
|
||||
|
||||
@@ -823,7 +823,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
|
||||
Versioning
|
||||
------------
|
||||
|
||||
Current: **v6.0.1**
|
||||
Current: **v6.0.2**
|
||||
|
||||
Stable: **[v5/fasthttp](https://github.com/kataras/iris/tree/5.0.0)**
|
||||
|
||||
|
||||
@@ -200,7 +200,11 @@ func (ctx *Context) Method() string {
|
||||
|
||||
// Host returns the host part of the current url
|
||||
func (ctx *Context) Host() string {
|
||||
return ctx.Request.URL.Host
|
||||
h := ctx.Request.URL.Host
|
||||
if h == "" {
|
||||
h = ctx.Request.Host
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
// ServerHost returns the server host taken by *http.Request.Host
|
||||
|
||||
55
http_test.go
55
http_test.go
@@ -426,6 +426,61 @@ func TestMuxSimpleParty(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRealSubdomainSimple exists because the local examples some times passed but...
|
||||
// hope that travis will not has problem with this
|
||||
func TestRealSubdomainSimple(t *testing.T) {
|
||||
|
||||
api := iris.New()
|
||||
host := "localhost:" + strconv.Itoa(getRandomNumber(4732, 4958))
|
||||
subdomain := "admin"
|
||||
subdomainHost := subdomain + "." + host
|
||||
|
||||
// no order, you can register subdomains at the end also.
|
||||
admin := api.Party(subdomain + ".")
|
||||
{
|
||||
// admin.mydomain.com
|
||||
admin.Get("/", func(c *iris.Context) {
|
||||
c.Writef("INDEX FROM %s", subdomainHost)
|
||||
})
|
||||
// admin.mydomain.com/hey
|
||||
admin.Get("/hey", func(c *iris.Context) {
|
||||
c.Writef(subdomainHost + c.Request.RequestURI)
|
||||
})
|
||||
// admin.mydomain.com/hey2
|
||||
admin.Get("/hey2", func(c *iris.Context) {
|
||||
c.Writef(subdomainHost + c.Request.RequestURI)
|
||||
})
|
||||
}
|
||||
|
||||
// mydomain.com/
|
||||
api.Get("/", func(c *iris.Context) {
|
||||
c.Writef("INDEX FROM no-subdomain hey")
|
||||
})
|
||||
|
||||
// mydomain.com/hey
|
||||
api.Get("/hey", func(c *iris.Context) {
|
||||
c.Writef("HEY FROM no-subdomain hey")
|
||||
})
|
||||
|
||||
api.Config.DisableBanner = true
|
||||
go api.Listen(host)
|
||||
|
||||
<-api.Available
|
||||
|
||||
e := httptest.New(api, t, httptest.ExplicitURL(true))
|
||||
|
||||
e.GET("/").Expect().Status(iris.StatusOK).Body().Equal("INDEX FROM no-subdomain hey")
|
||||
e.GET("/hey").Expect().Status(iris.StatusOK).Body().Equal("HEY FROM no-subdomain hey")
|
||||
|
||||
sub := e.Builder(func(req *httpexpect.Request) {
|
||||
req.WithURL("http://admin." + host)
|
||||
})
|
||||
|
||||
sub.GET("/").Expect().Status(iris.StatusOK).Body().Equal("INDEX FROM " + subdomainHost)
|
||||
sub.GET("/hey").Expect().Status(iris.StatusOK).Body().Equal(subdomainHost + "/hey")
|
||||
sub.GET("/hey2").Expect().Status(iris.StatusOK).Body().Equal(subdomainHost + "/hey2")
|
||||
}
|
||||
|
||||
func TestMuxPathEscape(t *testing.T) {
|
||||
iris.ResetDefault()
|
||||
|
||||
|
||||
3
iris.go
3
iris.go
@@ -81,7 +81,7 @@ const (
|
||||
// IsLongTermSupport flag is true when the below version number is a long-term-support version
|
||||
IsLongTermSupport = false
|
||||
// Version is the current version number of the Iris web framework
|
||||
Version = "6.0.1"
|
||||
Version = "6.0.2"
|
||||
|
||||
banner = ` _____ _
|
||||
|_ _| (_)
|
||||
@@ -416,7 +416,6 @@ func (s *Framework) Build() {
|
||||
|
||||
// set the mux' hostname (for multi subdomain routing)
|
||||
s.mux.hostname = ParseHostname(s.Config.VHost)
|
||||
|
||||
if s.ln != nil { // user called Listen functions or Serve,
|
||||
// create the main server
|
||||
s.srv = &http.Server{
|
||||
|
||||
Reference in New Issue
Block a user