Golang net/http.ServeMux.Handler() and ServeHTTP() functions example

package net/http

Golang net/http.ServeMux.Handler() and ServeHTTP() functions usage example

 mux := http.NewServeMux()
 h, pattern := mux.Handler(r)

 fmt.Println(pattern)

 var rw http.ResponseWriter
 var req *http.Request

 h.ServeHTTP(w, r)

References :

http://golang.org/pkg/net/http/#ServeMux.Handler

http://golang.org/pkg/net/http/#ServeMux.ServeHTTP

http://golang.org/src/net/http/serve_test.go

Advertisement