From: Anders Pearson Date: Sun, 3 Jul 2016 13:22:06 +0000 (+0100) Subject: expvar: export http.Handler X-Git-Tag: go1.8beta1~1171 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6ba5b32922c438a608a11561100a8a80abf0fd3a;p=gostls13.git expvar: export http.Handler Add a method to expose the handler to allow it to be installed at a non-standard location or used with a different ServeMux. fixes #15030 Change-Id: If778ad6fcc200f124a05c0a493511e364fca6078 Reviewed-on: https://go-review.googlesource.com/24722 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/expvar/expvar.go b/src/expvar/expvar.go index d5465c518f..fde763d7ce 100644 --- a/src/expvar/expvar.go +++ b/src/expvar/expvar.go @@ -322,6 +322,13 @@ func expvarHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "\n}\n") } +// Handler returns the expvar HTTP Handler. +// +// This is only needed to install the handler in a non-standard location. +func Handler() http.Handler { + return http.HandlerFunc(expvarHandler) +} + func cmdline() interface{} { return os.Args }