feat(gax): add mutable extension accessors to RequestOptions - #6254
feat(gax): add mutable extension accessors to RequestOptions#6254olavloite wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request bumps the version of google-cloud-gax to 1.14.0 and adds get_extension_mut and get_extension_or_default_mut methods to RequestOptions to support mutable extension retrieval. The review feedback correctly points out that the Clone trait bound on get_extension_or_default_mut is unnecessary because the default value is inserted directly by value, and removing it would make the API more flexible.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6254 +/- ##
=======================================
Coverage 96.07% 96.07%
=======================================
Files 275 275
Lines 68829 68860 +31
=======================================
+ Hits 66126 66160 +34
+ Misses 2703 2700 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add `get_extension_mut` and `get_extension_or_default_mut` to the `RequestOptionsExt` trait and implement them for `RequestOptions`. These methods allow client library layers to mutate request option extensions in place (such as injecting or updating headers in an existing `HeaderMap`) without needing to clone or re-insert the extension.
615ee69 to
01be876
Compare
coryan
left a comment
There was a problem hiding this comment.
I think you intended this as an example:
These methods allow client library layers to mutate request option extensions in place (such as injecting or updating headers in an existing HeaderMap) without needing to clone or re-insert the extension.
I must ask, if this is the only use-case you had in mind, would the changes in #6260 satisfy your needs? I would like to avoid two different ways to set headers.
If you had other cases in mind, then this looks good.
Add
get_extension_mutandget_extension_or_default_mutto theRequestOptionsExttrait and implement them forRequestOptions.These methods allow client library layers to mutate request option extensions in place (such as injecting or updating headers in an existing
HeaderMap) without needing to clone or re-insert the extension.