mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
fix middleware code
This commit is contained in:
parent
12ee66dfdf
commit
11ec1cd5c2
@ -107,7 +107,7 @@ func hello(wr http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func timeMiddleware(next http.Handler) http.Handler {
|
func timeMiddleware(next http.Handler) http.Handler {
|
||||||
return func(wr http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(wr http.ResponseWriter, r *http.Request) {
|
||||||
timeStart := time.Now()
|
timeStart := time.Now()
|
||||||
|
|
||||||
// next handler
|
// next handler
|
||||||
@ -115,7 +115,7 @@ func timeMiddleware(next http.Handler) http.Handler {
|
|||||||
|
|
||||||
timeElapsed := time.Since(timeStart)
|
timeElapsed := time.Since(timeStart)
|
||||||
logger.Println(timeElapsed)
|
logger.Println(timeElapsed)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user