Skip to content

Commit 9c97a8a

Browse files
committed
Update to version 12.1.6
Former-commit-id: 4d39e8a764a7c0d91b19a3710d8afe6c8c208c62
1 parent d4e38da commit 9c97a8a

File tree

14 files changed

+145
-120
lines changed

14 files changed

+145
-120
lines changed

HISTORY.md

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene
2121

2222
**How to upgrade**: Open your command-line and execute this command: `go get github.com/kataras/iris/v12@latest`.
2323

24+
# We, 05 February 2020 | v12.1.6
25+
26+
Fixes:
27+
28+
- [jet.View - urlpath error](https://github.com/kataras/iris/issues/1438)
29+
- [Context.ServeFile send 'application/wasm' with a wrong extra field](https://github.com/kataras/iris/issues/1440)
30+
2431
# Su, 02 February 2020 | v12.1.5
2532

2633
Various improvements and linting.

HISTORY_ES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Los desarrolladores no están obligados a actualizar si realmente no lo necesita
2121

2222
**Cómo actualizar**: Abra su línea de comandos y ejecute este comando: `go get github.com/kataras/iris/v12@latest`.
2323

24-
# Su, 02 February 2020 | v12.1.5
24+
# We, 05 February 2020 | v12.1.6
2525

26-
Not translated yet, please navigate to the [english version](HISTORY.md#su-02-february-2020--v1215) instead.
26+
Not translated yet, please navigate to the [english version](HISTORY.md#we-05-february-2020--v1216) instead.
2727

2828
# Sábado, 26 de octubre 2019 | v12.0.0
2929

NOTICE

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ Revision ID: 607b5b7cef034da2692f99a4c9bafb31a999ccda
5151
jade 9ffefa50b5f3141 https://github.com/Joker/jade
5252
6ac643e9d9ad611
5353
6f4688705f
54+
jet 33cfc27b3e00072 github.com/CloudyKit/jet
55+
655fdb3af24c325
56+
3ea5bffb8f
5457
json-iterator 08047c174c6c03e https://github.com/json-iterator/go
5558
8ec963a411bde1b
5659
6d1ee67b26

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# News
22

3-
![](https://iris-go.com/images/release.png) Iris version **12.1.5** has been [released](HISTORY.md#su-02-february-2020--v1215)!
3+
![](https://iris-go.com/images/release.png) Iris version **12.1.6** has been [released](HISTORY.md#we-05-february-2020--v1216)!
44

55
![](https://iris-go.com/images/cli.png) The official [Iris Command Line Interface](https://github.com/kataras/iris-cli) will soon be near you in 2020!
66

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.1.5:https://github.com/kataras/iris/releases/tag/v12.1.5
1+
12.1.6:https://github.com/kataras/iris/releases/tag/v12.1.6

_examples/http-listening/custom-listener/unix-reuseport/main.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import (
1919
"github.com/kataras/iris/v12"
2020
)
2121

22-
// $ go get github.com/valyala/tcplisten
23-
// $ go run main.go
24-
22+
// You can run the same app as many times as you want.
2523
func main() {
2624
app := iris.New()
2725

@@ -35,7 +33,7 @@ func main() {
3533
FastOpen: true,
3634
}
3735

38-
l, err := listenerCfg.NewListener("tcp", ":8080")
36+
l, err := listenerCfg.NewListener("tcp4", ":8080")
3937
if err != nil {
4038
panic(err)
4139
}

_examples/view/template_jet_0/main.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,13 @@ func main() {
125125
ctx.ViewData("showingAllDone", true)
126126
ctx.ViewData("title", "Todos - All Done")
127127

128-
// Key does not actual matter at all here.
129-
// However, you can enable it for better performance.
130-
// In order to enable key mapping for
131-
// jet specific renderer and ranger types
132-
// you have to initialize the View Engine
133-
// with `tmpl.DisableViewDataTypeCheck("_jet")`.
134-
//
135-
// Defaults to type checks, empty key.
136-
ctx.ViewData("_jet", (&doneTODOs{}).New(todos))
137-
ctx.View("todos/index.jet")
128+
// Use ctx.ViewData("_jet", jetData)
129+
// if using as middleware and you want
130+
// to pre-set the value or even change it later on from another next middleware.
131+
// ctx.ViewData("_jet", (&doneTODOs{}).New(todos))
132+
// and ctx.View("todos/index.jet")
133+
// OR
134+
ctx.View("todos/index.jet", (&doneTODOs{}).New(todos))
138135
})
139136

140137
port := os.Getenv("PORT")

_examples/view/template_jet_0/views/todos/show.jet

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{{block documentBody()}}
44
<h1>Show TODO</h1>
5-
<p>This uses a custom renderer by implementing the jet.Renderer interface.
5+
<p>This uses a custom renderer by implementing the jet.Renderer (or view.JetRenderer) interface.
66
<p>
77
{{.}}
88
</p>

_examples/view/template_jet_2/main.go

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Package main an example on how to naming your routes & use the custom 'url path' Jet Template Engine.
2+
package main
3+
4+
import (
5+
"github.com/kataras/iris/v12"
6+
)
7+
8+
func main() {
9+
app := iris.New()
10+
app.RegisterView(iris.Jet("./views", ".jet").Reload(true))
11+
12+
mypathRoute := app.Get("/mypath", writePathHandler)
13+
mypathRoute.Name = "my-page1"
14+
15+
mypath2Route := app.Get("/mypath2/{paramfirst}/{paramsecond}", writePathHandler)
16+
mypath2Route.Name = "my-page2"
17+
18+
mypath3Route := app.Get("/mypath3/{paramfirst}/statichere/{paramsecond}", writePathHandler)
19+
mypath3Route.Name = "my-page3"
20+
21+
mypath4Route := app.Get("/mypath4/{paramfirst}/statichere/{paramsecond}/{otherparam}/{something:path}", writePathHandler)
22+
// same as: app.Get("/mypath4/:paramfirst/statichere/:paramsecond/:otherparam/*something", writePathHandler)
23+
mypath4Route.Name = "my-page4"
24+
25+
// same with Handle/Func
26+
mypath5Route := app.Handle("GET", "/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{something:path}", writePathHandler)
27+
mypath5Route.Name = "my-page5"
28+
29+
mypath6Route := app.Get("/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}", writePathHandler)
30+
mypath6Route.Name = "my-page6"
31+
32+
app.Get("/", func(ctx iris.Context) {
33+
// for /mypath6...
34+
paramsAsArray := []string{"theParam1", "theParam2", "paramThirdAfterStatic"}
35+
ctx.ViewData("ParamsAsArray", paramsAsArray)
36+
if err := ctx.View("page.jet"); err != nil {
37+
panic(err)
38+
}
39+
})
40+
41+
app.Get("/redirect/{namedRoute}", func(ctx iris.Context) {
42+
routeName := ctx.Params().Get("namedRoute")
43+
r := app.GetRoute(routeName)
44+
if r == nil {
45+
ctx.StatusCode(iris.StatusNotFound)
46+
ctx.Writef("Route with name %s not found", routeName)
47+
return
48+
}
49+
50+
println("The path of " + routeName + "is: " + r.Path)
51+
// if routeName == "my-page1"
52+
// prints: The path of of my-page1 is: /mypath
53+
// if it's a path which takes named parameters
54+
// then use "r.ResolvePath(paramValuesHere)"
55+
ctx.Redirect(r.Path)
56+
// http://localhost:8080/redirect/my-page1 will redirect to -> http://localhost:8080/mypath
57+
})
58+
59+
// http://localhost:8080
60+
// http://localhost:8080/redirect/my-page1
61+
app.Run(iris.Addr(":8080"))
62+
}
63+
64+
func writePathHandler(ctx iris.Context) {
65+
ctx.Writef("Hello from %s.", ctx.Path())
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<a href="{{urlpath("my-page1")}}">/mypath</a>
2+
<br />
3+
<br/>
4+
<a href="{{urlpath("my-page2","theParam1","theParam2")}}">/mypath2/{paramfirst}/{paramsecond}</a>
5+
<br />
6+
<br />
7+
8+
<a href="{{urlpath("my-page3", "theParam1", "theParam2AfterStatic")}}">/mypath3/{paramfirst}/statichere/{paramsecond}</a>
9+
<br />
10+
<br />
11+
12+
<a href="{{urlpath("my-page4", "theParam1", "theparam2AfterStatic", "otherParam", "matchAnything")}}">
13+
/mypath4/{paramfirst}/statichere/{paramsecond}/{otherparam}/{something:path}</a>
14+
<br />
15+
<br />
16+
17+
<a href="{{urlpath("my-page5", "theParam1", "theParam2Afterstatichere", "otherParam", "matchAnythingAfterStatic")}}">
18+
/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{anything:path}</a>
19+
<br />
20+
<br />
21+
22+
<a href={{urlpath("my-page6", .ParamsAsArray)}}>
23+
/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}
24+
</a>

doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Source code and other details for the project are available at GitHub:
3838
3939
Current Version
4040
41-
12.1.5
41+
12.1.6
4242
4343
Installation
4444

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.13
44

55
require (
66
github.com/BurntSushi/toml v0.3.1
7-
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible
7+
github.com/CloudyKit/jet/v3 v3.0.0
88
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7
99
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398
1010
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible

iris.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141
)
4242

4343
// Version is the current version number of the Iris Web Framework.
44-
const Version = "12.1.5"
44+
const Version = "12.1.6"
4545

4646
// HTTP status codes as registered with IANA.
4747
// See: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml.
@@ -583,9 +583,17 @@ func (app *Application) NewHost(srv *http.Server) *host.Supervisor {
583583
srv.ErrorLog = log.New(app.logger.Printer.Output, "[HTTP Server] ", 0)
584584
}
585585

586-
if srv.Addr == "" {
587-
srv.Addr = ":8080"
586+
if addr := srv.Addr; addr == "" {
587+
addr = ":8080"
588+
if len(app.Hosts) > 0 {
589+
if v := app.Hosts[0].Server.Addr; v != "" {
590+
addr = v
591+
}
592+
}
593+
594+
srv.Addr = addr
588595
}
596+
589597
app.logger.Debugf("Host: addr is %s", srv.Addr)
590598

591599
// create the new host supervisor

0 commit comments

Comments
 (0)