minor, see prev commit

This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-08-01 05:11:08 +03:00
parent acf058b006
commit 676048666c
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7
2 changed files with 13 additions and 8 deletions

View File

@ -153,7 +153,7 @@ Prior to this version the `iris.Context` was the only one dependency that has be
| [http.ResponseWriter](https://golang.org/pkg/net/http/#ResponseWriter) | `ctx.ResponseWriter()` |
| [http.Header](https://golang.org/pkg/net/http/#Header) | `ctx.Request().Header` |
| [time.Time](https://golang.org/pkg/time/#Time) | `time.Now()` |
| [golog.Logger](https://pkg.go.dev/github.com/kataras/golog) | Iris Logger |
| [*golog.Logger](https://pkg.go.dev/github.com/kataras/golog) | Iris Logger |
| [net.IP](https://golang.org/pkg/net/#IP) | `net.ParseIP(ctx.RemoteAddr())` |
| `string`, | |
| `int, int8, int16, int32, int64`, | |

View File

@ -8,6 +8,7 @@ import (
"testing"
"time"
"github.com/kataras/golog"
"github.com/kataras/iris/v12/context"
"github.com/kataras/iris/v12/sessions"
)
@ -185,7 +186,7 @@ func TestGetBindingsForFunc(t *testing.T) {
},
// test std context, session, time, request, response writer and headers bindings.
{ // 12
Func: func(stdContext.Context, *sessions.Session, time.Time, *http.Request, http.ResponseWriter, http.Header) testResponse {
Func: func(stdContext.Context, *sessions.Session, *golog.Logger, time.Time, *http.Request, http.ResponseWriter, http.Header) testResponse {
return testResponse{"builtin deps"}
},
Expected: []*binding{
@ -199,11 +200,11 @@ func TestGetBindingsForFunc(t *testing.T) {
},
{
Dependency: NewDependency(BuiltinDependencies[3]),
Input: &Input{Index: 2, Type: timeTyp},
Input: &Input{Index: 2, Type: BuiltinDependencies[3].DestType},
},
{
Dependency: NewDependency(BuiltinDependencies[4]),
Input: &Input{Index: 3, Type: BuiltinDependencies[4].DestType},
Input: &Input{Index: 3, Type: timeTyp},
},
{
Dependency: NewDependency(BuiltinDependencies[5]),
@ -213,6 +214,10 @@ func TestGetBindingsForFunc(t *testing.T) {
Dependency: NewDependency(BuiltinDependencies[6]),
Input: &Input{Index: 5, Type: BuiltinDependencies[6].DestType},
},
{
Dependency: NewDependency(BuiltinDependencies[7]),
Input: &Input{Index: 6, Type: BuiltinDependencies[7].DestType},
},
},
},
// test explicitly of http.Header and its underline type map[string][]string which
@ -225,8 +230,8 @@ func TestGetBindingsForFunc(t *testing.T) {
},
Expected: []*binding{
{
Dependency: NewDependency(BuiltinDependencies[6]),
Input: &Input{Index: 0, Type: BuiltinDependencies[6].DestType},
Dependency: NewDependency(BuiltinDependencies[7]),
Input: &Input{Index: 0, Type: BuiltinDependencies[7].DestType},
},
},
},
@ -247,8 +252,8 @@ func TestGetBindingsForFunc(t *testing.T) {
},
Expected: []*binding{ // only http.Header should be binded, we don't have map[string][]string registered.
{
Dependency: NewDependency(BuiltinDependencies[6]),
Input: &Input{Index: 0, Type: BuiltinDependencies[6].DestType},
Dependency: NewDependency(BuiltinDependencies[7]),
Input: &Input{Index: 0, Type: BuiltinDependencies[7].DestType},
},
{
Dependency: deps[len(deps)-1],