chore: simplify tests with logtest (#3184)
This commit is contained in:
@@ -31,14 +31,14 @@ const (
|
||||
// Notice: even if canceled in server side, 499 will be logged as well.
|
||||
func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
if duration > 0 {
|
||||
return &timeoutHandler{
|
||||
handler: next,
|
||||
dt: duration,
|
||||
}
|
||||
if duration <= 0 {
|
||||
return next
|
||||
}
|
||||
|
||||
return next
|
||||
return &timeoutHandler{
|
||||
handler: next,
|
||||
dt: duration,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,9 +207,11 @@ func relevantCaller() runtime.Frame {
|
||||
if !strings.HasPrefix(frame.Function, "net/http.") {
|
||||
return frame
|
||||
}
|
||||
|
||||
if !more {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return frame
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user