1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-31 08:47:03 +00:00

version 12.1.5

Former-commit-id: cda69f08955cb0d594e98bf26197ee573cbba4b2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-02 16:29:06 +02:00
parent e04ea83c04
commit 3093d65363
76 changed files with 9647 additions and 366 deletions

View File

@@ -14,13 +14,13 @@ import (
// .FromStd(func(w http.ResponseWriter, r *http.Request))
// .FromStd(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc))
func FromStd(handler interface{}) context.Handler {
switch handler.(type) {
switch h := handler.(type) {
case context.Handler:
{
//
// it's already a iris handler
//
return handler.(context.Handler)
return h
}
case http.Handler:
@@ -28,7 +28,6 @@ func FromStd(handler interface{}) context.Handler {
// handlerFunc.ServeHTTP(w,r)
//
{
h := handler.(http.Handler)
return func(ctx context.Context) {
h.ServeHTTP(ctx.ResponseWriter(), ctx.Request())
}
@@ -39,7 +38,7 @@ func FromStd(handler interface{}) context.Handler {
//
// handlerFunc(w,r)
//
return FromStd(http.HandlerFunc(handler.(func(http.ResponseWriter, *http.Request))))
return FromStd(http.HandlerFunc(h))
}
case func(http.ResponseWriter, *http.Request, http.HandlerFunc):
@@ -47,7 +46,7 @@ func FromStd(handler interface{}) context.Handler {
//
// handlerFunc(w,r, http.HandlerFunc)
//
return FromStdWithNext(handler.(func(http.ResponseWriter, *http.Request, http.HandlerFunc)))
return FromStdWithNext(h)
}
default: