Skip to content

Commit

Permalink
expvar: export http.Handler
Browse files Browse the repository at this point in the history
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
thraxil authored and bradfitz committed Sep 25, 2016
1 parent f05cd4c commit 6ba5b32
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/expvar/expvar.go
Expand Up @@ -322,6 +322,13 @@ func expvarHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "\n}\n") 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{} { func cmdline() interface{} {
return os.Args return os.Args
} }
Expand Down

0 comments on commit 6ba5b32

Please sign in to comment.