package main import ( "fmt" "net/http" "github.com/onsi/gomega/ghttp" ) func main() { // create a new ghttp server server := ghttp.NewServer() // map requests to the /hello endpoint to the helloHandler function server.RouteToHandler("GET", "/hello", http.HandlerFunc(helloHandler)) // start the server server.Start() // make a GET request to the /hello endpoint resp, err := http.Get(server.URL() + "/hello") if err != nil { panic(err) } // print the response body fmt.Println(resp.Status) // stop the server server.Close() } func helloHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, world!")) }In this example, we create a new ghttp server, map requests to the /hello endpoint to the helloHandler function, start the server, make a GET request to the /hello endpoint, and print the response body. Finally, we stop the server. Overall, ghttp provides a convenient and powerful means for writing automated tests for HTTP endpoints in Go.