Skip to content

Commit

Permalink
fix(transport): fix the problem that the context is not delivered cor…
Browse files Browse the repository at this point in the history
…rectly (#1906)
  • Loading branch information
shenqidebaozi authored and tonybase committed May 31, 2022
1 parent 1873cea commit a58dd0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions transport/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func (s *Server) filter() mux.MiddlewareFunc {
// /path/123 -> /path/{id}
pathTemplate, _ = route.GetPathTemplate()
}

tr := &Transport{
endpoint: s.endpoint.String(),
operation: pathTemplate,
Expand All @@ -215,8 +216,9 @@ func (s *Server) filter() mux.MiddlewareFunc {
request: req,
pathTemplate: pathTemplate,
}
ctx = transport.NewServerContext(ctx, tr)
next.ServeHTTP(w, req.WithContext(ctx))

tr.request = req.WithContext(transport.NewServerContext(ctx, tr))
next.ServeHTTP(w, tr.request)
})
}
}
Expand Down

0 comments on commit a58dd0c

Please sign in to comment.