Provide option in RequestIdPlugin/CorrelationIdPlugin to always create a new UUID
derekbekoe opened this issue · 1 comments
Instead of accepting the user provided id, it would be nice if there was a way to always use the server-side generated id.
Currently, if the client has set the header to a value, that value is always preferred so the server doesn't generate a new one. It would be nice if both modes could be supported through a new kwarg which wouldn't introduce a breaking change.
starlette-context/starlette_context/plugins/correlation_id.py
Lines 14 to 22 in 79aa8ff
Happy to submit a PR if needed.
Derek, let me start by saying I'm really happy to see new tickets. Keep it coming and let's discuss stuff!
I want to keep those plugins generic and simple. Also, I don't like passing booleans to methods that alter their behavior.
I was thinking about what you've suggested, whether it's your specific use case or people might need it and I think I could have used it myself. So let's do this!
I'm open to PRs but I don't think I have the time for reviewing and merging during weekdays.
Please feel free to open a PR. Otherwise, I will gladly implement this over the weekend.