From aa415bc4aa478d5a156999515e092a7fe4a5b8e2 Mon Sep 17 00:00:00 2001 From: Carl Johnson Date: Tue, 28 Mar 2023 11:06:09 -0400 Subject: [PATCH] ExampleTestServerConfig: More example text --- config_example_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config_example_test.go b/config_example_test.go index f5887b9..8ee7eeb 100644 --- a/config_example_test.go +++ b/config_example_test.go @@ -59,6 +59,7 @@ func ExampleGzipConfig() { } func ExampleTestServerConfig() { + // Create an httptest.Server for your project's router mux := http.NewServeMux() mux.HandleFunc("/greeting", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello, world!") @@ -70,6 +71,7 @@ func ExampleTestServerConfig() { srv := httptest.NewServer(mux) defer srv.Close() + // Now test that the handler has the expected return values { var s string err := requests. @@ -80,7 +82,7 @@ func ExampleTestServerConfig() { if err != nil { fmt.Println("Error!", err) } - fmt.Println(s) + fmt.Println(s) // Hello, world! } { var s string @@ -92,7 +94,7 @@ func ExampleTestServerConfig() { if err != nil { fmt.Println("Error!", err) } - fmt.Println(s) + fmt.Println(s) // Howdy, planet! } // Output: // Hello, world!