Rename timeout middleware
This commit is contained in:
@ -6,13 +6,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// TimeoutMiddleware is necessary in addition to http.Server's ReadTimeout,
|
||||
// Timeout is necessary in addition to http.Server's ReadTimeout,
|
||||
// WriteTimeout, and IdleTimeout. http.Server's timeouts are network-level
|
||||
// timeouts, while this middleware's timeout is at the application level.
|
||||
// TODO: Verify this statement
|
||||
|
||||
// TimeoutMiddleware sets a timeout for each request
|
||||
func TimeoutMiddleware(duration time.Duration) Middleware {
|
||||
// Timeout sets a timeout for each request
|
||||
func Timeout(duration time.Duration) Middleware {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// Create a context with a timeout
|
||||
|
Reference in New Issue
Block a user