fix golint issues, exported doc (#451)

This commit is contained in:
Kevin Wan
2021-02-08 21:31:56 +08:00
committed by GitHub
parent 9b0625bb83
commit 54414db91d
8 changed files with 31 additions and 11 deletions

View File

@@ -7,12 +7,13 @@ import (
const reason = "Request Timeout"
// TimeoutHandler returns the handler with given timeout.
func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
if duration > 0 {
return http.TimeoutHandler(next, duration, reason)
} else {
return next
}
return next
}
}