1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-30 00:07:04 +00:00

Update to version 8.5.5 | Read HISTORY.md

Former-commit-id: dced7d472edabbab4f80c76051f13261928a8dea
This commit is contained in:
kataras
2017-11-02 05:54:33 +02:00
parent 666bcacf20
commit 15feaf0237
100 changed files with 13338 additions and 13155 deletions

View File

@@ -2,6 +2,7 @@ package ast
import (
"fmt"
"reflect"
"strconv"
)
@@ -50,6 +51,40 @@ const (
ParamTypePath
)
// Not because for a single reason
// a string may be a
// ParamTypeString or a ParamTypeFile
// or a ParamTypePath or ParamTypeAlphabetical.
//
// func ParamTypeFromStd(k reflect.Kind) ParamType {
// Kind returns the std kind of this param type.
func (pt ParamType) Kind() reflect.Kind {
switch pt {
case ParamTypeAlphabetical:
fallthrough
case ParamTypeFile:
fallthrough
case ParamTypePath:
fallthrough
case ParamTypeString:
return reflect.String
case ParamTypeInt:
return reflect.Int
case ParamTypeLong:
return reflect.Int64
case ParamTypeBoolean:
return reflect.Bool
}
return reflect.Invalid // 0
}
// Assignable returns true if the "k" standard type
// is assignabled to this ParamType.
func (pt ParamType) Assignable(k reflect.Kind) bool {
return pt.Kind() == k
}
var paramTypes = map[string]ParamType{
"string": ParamTypeString,
"int": ParamTypeInt,

View File

@@ -235,7 +235,7 @@ var types = map[string]string{
".mov": "video/quicktime",
".movie": "video/x-sgi-movie",
".mp2": "audio/mpeg",
".mp3": "audio/mpeg3",
".mp3": "audio/mpeg",
".mp4": "video/mp4",
".mpa": "audio/mpeg",
".mpc": "application/x-project",

View File

@@ -102,7 +102,7 @@ func (nodes *Nodes) add(routeName, path string, paramNames []string, handlers co
// set the wildcard param name to the root and its children.
wildcardIdx := strings.IndexByte(path, '*')
wildcardParamName := ""
if wildcardIdx > 0 && len(paramNames) == 0 {
if wildcardIdx > 0 && len(paramNames) == 0 { // 27 Oct comment: && len(paramNames) == 0 {
wildcardParamName = path[wildcardIdx+1:]
path = path[0:wildcardIdx-1] + "/" // replace *paramName with single slash
@@ -213,12 +213,14 @@ loop:
handlers: handlers,
root: root,
}
// println("3.5. nodes.Add path: " + n.s)
// println("3.5. nodes.Add path: " + n.s)
*nodes = append(*nodes, n)
return
}
// println("4. nodes.Add path: " + path[len(n.s):])
err = n.childrenNodes.add(routeName, path[len(n.s):], paramNames, handlers, false)
pathToAdd := path[len(n.s):]
// println("4. nodes.Add path: " + pathToAdd)
err = n.childrenNodes.add(routeName, pathToAdd, paramNames, handlers, false)
return err
}
@@ -231,10 +233,19 @@ loop:
}
n.paramNames = paramNames
n.handlers = handlers
return
}
// START
// Author's note:
// 27 Oct 2017; fixes s|i|l+static+p
// without breaking the current tests.
if wildcardIdx > 0 {
wildcardParamName = path[wildcardIdx+1:]
path = path[0:wildcardIdx-1] + "/"
}
// END
n := &node{
s: path,
routeName: routeName,