Explorar o código

排除客户端中断导致的503错误 (#1343)

vic %!s(int64=3) %!d(string=hai) anos
pai
achega
2cdf5e7395
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      rest/handler/loghandler.go

+ 1 - 1
rest/handler/loghandler.go

@@ -185,7 +185,7 @@ func logBrief(r *http.Request, code int, timer *utils.ElapsedTimer, logs *intern
 		buf.WriteString(fmt.Sprintf("\n%s", body))
 	}
 
-	if ok {
+	if ok || r.Context().Err() == context.Canceled  {
 		logger.Info(buf.String())
 	} else {
 		logger.Error(buf.String())