params_legacy.go 418 B

12345678910111213141516
  1. // +build !go1.7
  2. package httprouter
  3. import "net/http"
  4. // Handler is an adapter which allows the usage of an http.Handler as a
  5. // request handle. With go 1.7+, the Params will be available in the
  6. // request context under ParamsKey.
  7. func (r *Router) Handler(method, path string, handler http.Handler) {
  8. r.Handle(method, path,
  9. func(w http.ResponseWriter, req *http.Request) {
  10. handler.ServeHTTP(w, req)
  11. },
  12. )
  13. }