mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-20 16:45:56 +08:00
20 lines
375 B
Go
20 lines
375 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
s := &http.Server{
|
|
Addr: ":8080",
|
|
ReadHeaderTimeout: 500 * time.Millisecond,
|
|
ReadTimeout: 500 * time.Millisecond,
|
|
Handler: http.TimeoutHandler(handler{}, time.Second, "foo"),
|
|
}
|
|
_ = s
|
|
}
|
|
|
|
type handler struct{}
|
|
|
|
func (h handler) ServeHTTP(http.ResponseWriter, *http.Request) {}
|