You could do something like this perhaps (assuming I understood the question):
~~~
package main
import (
"io"
"net/http"
"net/http/httptest"
"os"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, world\n"))
})
ts := httptest.NewServer(r)
res, err := http.Get(ts.URL + "/hello")
catch(err)
io.Copy(os.Stdout, res.Body)
}
func catch(err error) {
if err != nil {
panic(err)
}
}
~~~
In the example above, I declared a Gorilla router, added a handler function. Then I created a test server using the router and made the http package perform a GET request on that "/hello" URL. Finally I copied the response body to the standard output. But this is where you can get creative; once you set up the test server, you can hit any endpoint and then validate the responses as desired.
Hope this helps.
Best regards,
Ridwan