package server import ( "net/http" "time" ) // Timeout returns a middleware that limits request processing time. // If the handler does not complete within d, the client receives a // 503 Service Unavailable response. It wraps http.TimeoutHandler. func Timeout(d time.Duration) Middleware { return func(next http.Handler) http.Handler { return http.TimeoutHandler(next, d, "Service Unavailable\n") } }