[feat] Add support for dynamically setting the authorization header in the http logging handler#3624
Open
JimPaine wants to merge 3 commits intoreframe-hpc:developfrom
Open
[feat] Add support for dynamically setting the authorization header in the http logging handler#3624JimPaine wants to merge 3 commits intoreframe-hpc:developfrom
JimPaine wants to merge 3 commits intoreframe-hpc:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3624 +/- ##
===========================================
+ Coverage 91.39% 91.64% +0.24%
===========================================
Files 62 62
Lines 13520 13526 +6
===========================================
+ Hits 12357 12396 +39
+ Misses 1163 1130 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
victorusu
reviewed
Feb 12, 2026
| "it must be 'json_formatter(record, extras, ignore_keys)'" | ||
| ) | ||
|
|
||
| if authorization_header is not None and not callable(authorization_header): |
Contributor
There was a problem hiding this comment.
I like this idea of having a dedicated authorization_header and I have the impression one needs it because one cannot pass a callable to the extra_headers. Have you considered passing a callable to extra_headers instead of having the dedicated authorization_header?
Author
There was a problem hiding this comment.
I did think about this and happy to take a second look.
My initial thoughts were:
extra_headersare expected to be strings and mapped as such in theinitmethod.- We could move this logic to the
emitmethod with a condition to check the type of each item inextra_headers - This would make it more flexible, allowing any header to be dynamically set just before making the HTTP request
- I prefer things to be implicit
- Handling of types within
extra_headerspotentially adds complexity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables the use of short lived tokens where http services use flows such as
client credentialsby allowing the authorization header to be set dynamically via a callable which is evaluated at the point the http request is made.Closes #3622