Blame vendor/github.com/julienschmidt/httprouter/params_legacy.go
|
Packit Service |
4d2de5 |
// +build !go1.7
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
package httprouter
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
import "net/http"
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// Handler is an adapter which allows the usage of an http.Handler as a
|
|
Packit Service |
4d2de5 |
// request handle. With go 1.7+, the Params will be available in the
|
|
Packit Service |
4d2de5 |
// request context under ParamsKey.
|
|
Packit Service |
4d2de5 |
func (r *Router) Handler(method, path string, handler http.Handler) {
|
|
Packit Service |
4d2de5 |
r.Handle(method, path,
|
|
Packit Service |
4d2de5 |
func(w http.ResponseWriter, req *http.Request, _ Params) {
|
|
Packit Service |
4d2de5 |
handler.ServeHTTP(w, req)
|
|
Packit Service |
4d2de5 |
},
|
|
Packit Service |
4d2de5 |
)
|
|
Packit Service |
4d2de5 |
}
|