Skip to content

Commit

Permalink
flathttp: set ctx after timeout set
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed May 24, 2020
1 parent fb7afd5 commit e7f95c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flathttp/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if m.Timeout > 0 {
ctx, cancel := context.WithTimeout(r.Context(), m.Timeout)

r = r.WithContext(ctx)

defer func() {
cancel()

Expand Down

0 comments on commit e7f95c7

Please sign in to comment.