Don't serialize redacted headers#742
Merged
Merged
Conversation
This required quite a lot of refactoring to clarify what's actually going on. It should now be clearer that there is a redacted sentinel value which is used to nicely format, print, and str redacted values that might be exposed to the user (I don't fully recall why I added this but I suspect it's because we only want to apply cli formatting at the exact time when the value is displayed). This code now lives in `utils-redacted.R`. I also clarified the type of the headers object — the componets can either be an atomic vector or a weakref. And since redacted components now have their own type, we no longer need the `redact` attribute. Fixes #721
Member
|
Practically there's no way to access the 'value' from the 'key' if the weakref itself is no longer around, hence it's probably fine that you tie the lifetime of 'value' to the package However, if you want to ensure the lifetime of 'value' is really tied to a single request, then you could instead pass the request |
And test `req_dry_run()` changes
Member
Author
|
I decided to make the lifespan a bit more explicit and I do think it makes it clearer. |
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.
This required quite a lot of refactoring to clarify what's actually going on. It should now be clearer that there is a redacted sentinel value which is used to nicely format, print, and str redacted values that might be exposed to the user (I don't fully recall why I added this but I suspect it's because we only want to apply cli formatting at the exact time when the value is displayed). This code now lives in
utils-redacted.R.I also clarified the type of the headers object — the componets can either be an atomic vector or a weakref. And since redacted components now have their own type, we no longer need the
redactattribute.Fixes #721