github.com/bketelsen/buffalo@v0.9.5/wrappers.go (about)

     1  package buffalo
     2  
     3  import "net/http"
     4  
     5  // WrapHandler wraps a standard http.Handler and transforms it
     6  // into a buffalo.Handler.
     7  func WrapHandler(h http.Handler) Handler {
     8  	return func(c Context) error {
     9  		h.ServeHTTP(c.Response(), c.Request())
    10  		return nil
    11  	}
    12  }
    13  
    14  // WrapHandlerFunc wraps a standard http.HandlerFunc and
    15  // transforms it into a buffalo.Handler.
    16  func WrapHandlerFunc(h http.HandlerFunc) Handler {
    17  	return WrapHandler(h)
    18  }