braintree / manners

A polite Go HTTP server that shuts down gracefully.
MIT License
997 stars 103 forks source link

Fix ListenAndServe(addr, nil) #47

Open grazzini opened 7 years ago

grazzini commented 7 years ago

The main example from the package comment doesn't work:

    http.Handle("/hello", func(w http.ResponseWriter, r *http.Request) {
      w.Write([]byte("Hello\n"))
    })

    log.Fatal(manners.ListenAndServe(":8080", nil))

This gives the panic mentioned in #39.

(See also #40, but IMHO it would be better to make this work than to show a workaround in the README.)