Closed sondrelg closed 2 years ago
Merging #15 (e9fe16f) into main (ca9691f) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## main #15 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 7 +1
Lines 129 137 +8
=========================================
+ Hits 129 137 +8
Impacted Files | Coverage Δ | |
---|---|---|
asgi_correlation_id/middleware.py | 100.00% <100.00%> (ø) |
|
asgi_correlation_id/validators.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ca9691f...e9fe16f. Read the comment docs.
LGTM
SonarCloud Quality Gate failed.
0 Bugs
0 Vulnerabilities
4 Security Hotspots
1 Code Smell
No Coverage information
0.0% Duplication
PR adds some more middleware arguments, which I think will make it a lot more flexible.
Changes
PR adds:
generator
callable so the ID-generating function becomes configurable,validators
which the user can provide or add to,transformer
callable which can be added to handle request IDs in any way neededAdding a generator makes it possible to supply other ID-generators, like nanoid. All we expect from a correlation/request ID header is for the value to be unique.
Adding the possibility of passing custom validators moves us away from UUID-based validation, which should make the middleware more flexible.
Adding a transformer would make it possible to solve #13 by stripping dashes and lowercasing UUID-formatted request IDs, if that's something you wanted. There are multiple possible uses for this, and with it added users will have full access to handle request IDs as they need.
Thoughts
None
. Is there a better way?validate_header_as_uuid
, but the behaviour stays the same for now. Is that enough to consider this a minor version upgrade? I think so.TODO: