Skip to content

Commit 8e9c8a5

Browse files
jfattasergiught
authored andcommitted
fix: CheckJWT clones the request (#89)
* fix: clone request with ctx * fix unnecessary pointer
1 parent 18a2cf6 commit 8e9c8a5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

jwtmiddleware.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ func (m *JWTMiddleware) CheckJWT(next http.Handler) http.Handler {
236236

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

0 commit comments

Comments
 (0)