Skip to content

Commit

Permalink
fix: CheckJWT clones the request (#89)
Browse files Browse the repository at this point in the history
* fix: clone request with ctx

* fix unnecessary pointer
  • Loading branch information
jfatta authored May 21, 2021
1 parent 0d1f50b commit 23c6193
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions jwtmiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ func (m *JWTMiddleware) CheckJWT(next http.Handler) http.Handler {

// no err means we have a valid token, so set it into the
// context and continue onto next
newRequest := r.WithContext(context.WithValue(r.Context(), ContextKey{}, validToken))
r = newRequest
r = r.Clone(context.WithValue(r.Context(), ContextKey{}, validToken))
next.ServeHTTP(w, r)
})
}

0 comments on commit 23c6193

Please sign in to comment.