Skip to content

Commit

Permalink
ExampleTestServerConfig: More example text
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed Mar 30, 2023
1 parent 829fc3d commit aa415bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand All @@ -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.
Expand All @@ -80,7 +82,7 @@ func ExampleTestServerConfig() {
if err != nil {
fmt.Println("Error!", err)
}
fmt.Println(s)
fmt.Println(s) // Hello, world!
}
{
var s string
Expand All @@ -92,7 +94,7 @@ func ExampleTestServerConfig() {
if err != nil {
fmt.Println("Error!", err)
}
fmt.Println(s)
fmt.Println(s) // Howdy, planet!
}
// Output:
// Hello, world!
Expand Down

0 comments on commit aa415bc

Please sign in to comment.