mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +00:00
add example for simple http.Handler wrapper
This commit is contained in:
@@ -32,6 +32,17 @@ func FromStd(handler interface{}) context.Handler {
|
||||
// handlerFunc(w,r, http.HandlerFunc)
|
||||
//
|
||||
return FromStdWithNext(h)
|
||||
case func(http.Handler) http.Handler:
|
||||
panic(fmt.Errorf(`
|
||||
Passed handler cannot be converted directly:
|
||||
- http.Handler(http.Handler)
|
||||
---------------------------------------------------------------------
|
||||
Please use the Application.WrapRouter method instead, example code:
|
||||
app := iris.New()
|
||||
// ...
|
||||
app.WrapRouter(func(w http.ResponseWriter, r *http.Request, router http.HandlerFunc) {
|
||||
httpThirdPartyHandler(router).ServeHTTP(w, r)
|
||||
})`))
|
||||
default:
|
||||
// No valid handler passed
|
||||
panic(fmt.Errorf(`
|
||||
|
||||
Reference in New Issue
Block a user