auth0 / go-jwt-middleware

A Middleware for Go Programming Language to check for JWTs on HTTP requests
MIT License
1.07k stars 205 forks source link

Replace `.Clone` method with `.WithContext` for *http.Request in a middleware #248

Closed kucherenkovova closed 7 months ago

kucherenkovova commented 7 months ago

📝 Checklist

🔧 Changes

Replace .Clone method with a more lightweight .WithContext for *http.Request in a middleware. WithContext returns a shallow copy while Clone does deep copy.

📚 References

kucherenkovova commented 7 months ago

FYI @ewanharris

ewanharris commented 7 months ago

Thanks for the PR @kucherenkovova, could you maybe expand on why you're making the change?

Reviewing the history, it appears like this library used to use WithContext but moved away from it in #89 due to an issue raised in #62, so I'm hesitant to revert back to Clone

kucherenkovova commented 7 months ago

@ewanharris you're right, Clone works better in this case. Closing the PR.