Adds WrapF() and WrapH()

This commit is contained in:
Manu Mtz-Almeida
2015-05-20 00:39:52 +02:00
parent e59475c615
commit c4914f0ff7
2 changed files with 29 additions and 4 deletions

View File

@ -13,12 +13,18 @@ import (
"strings"
)
func Wrap(f http.HandlerFunc) HandlerFunc {
func WrapF(f http.HandlerFunc) HandlerFunc {
return func(c *Context) {
f(c.Writer, c.Request)
}
}
func WrapH(h http.Handler) HandlerFunc {
return func(c *Context) {
h.ServeHTTP(c.Writer, c.Request)
}
}
type H map[string]interface{}
// Allows type H to be used with xml.Marshal