1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

Move the kataras/go-serializer into one iris' file.

Start organising the kataras/go-*package which are relative to the Iris
project. The kataras/go-*package will be exists and their features will
be adapted to Iris every 2 months, as we say at readme, iris-relative
packages should be tested for a long time before adapted to Iris.

With this way we have stability, code readability(the developer can
easly navigate to iris' code without need to move across different
kataras/ projects).


Former-commit-id: db291faaf59d4f53f14ce5800fde805f56c8b802
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-03-01 15:04:42 +02:00
parent a4ff95f1d9
commit 57aea4aa75
7 changed files with 287 additions and 54 deletions

View File

@@ -522,14 +522,17 @@ func New() iris.Policies {
RouterReversionPolicy: iris.RouterReversionPolicy{
// path normalization done on iris' side
StaticPath: func(path string) string {
i := strings.IndexByte(path, parameterStartByte)
x := strings.IndexByte(path, matchEverythingByte)
if i > -1 {
return path[0:i]
}
if x > -1 {
return path[0:x]
v := strings.IndexByte(path, matchEverythingByte)
if i > -1 || v > -1 {
if i < v {
return path[0:i]
}
// we can't return path[0:0]
if v > 0 {
return path[0:v]
}
}
return path

View File

@@ -125,13 +125,13 @@ func (h *Adaptor) Adapt(frame *iris.Policies) {
// adapt the build event to the main policies
evt.Adapt(frame)
r := iris.RenderPolicy(func(out io.Writer, file string, tmplContext interface{}, options ...map[string]interface{}) (error, bool) {
r := iris.RenderPolicy(func(out io.Writer, file string, tmplContext interface{}, options ...map[string]interface{}) (bool, error) {
// template mux covers that but maybe we have more than one RenderPolicy
// and each of them carries a different mux on the new design.
if strings.Contains(file, h.extension) {
return mux.ExecuteWriter(out, file, tmplContext, options...), true
return true, mux.ExecuteWriter(out, file, tmplContext, options...)
}
return nil, false
return false, nil
})
r.Adapt(frame)