1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

fix server info bug

This commit is contained in:
longXboy 2021-05-30 21:43:41 +08:00
parent 149fc0195e
commit 63191930ed

View File

@ -101,7 +101,7 @@ func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
ctx = transport.NewContext(ctx, transport.Transport{Kind: transport.KindHTTP})
ctx = NewServerContext(ctx, ServerInfo{Request: req, Response: res})
if s.timeout > 0 {
ctx, cancel = context.WithTimeout(req.Context(), s.timeout)
ctx, cancel = context.WithTimeout(ctx, s.timeout)
defer cancel()
}
s.router.ServeHTTP(res, req.WithContext(ctx))