feat(gax-internal): builder for raw HTTP requests#4755
Merged
coryan merged 6 commits intogoogleapis:mainfrom Feb 23, 2026
Merged
feat(gax-internal): builder for raw HTTP requests#4755coryan merged 6 commits intogoogleapis:mainfrom
coryan merged 6 commits intogoogleapis:mainfrom
Conversation
Most client libraries use `ReqwestClient` to make HTTP+JSON RPCs. In the Storage client (and maybe in others) we need to make raw HTTP requests. These are different in seveal dimensions: - The retry loop is typically implemented outside the `ReqwestClient`, so calling `execute()` is a problem. - The URL may target an endpoint that is different from the `ReqwestClient`'s endpoint, so the host header needs adjustment. - The request or response may be streamed instead of parsed from/to a JSON value. It was getting too hard to keep these things in mind, adding a new type makes it harder to use these incorrectly. I also refactored some of the tests to remove duplicated code.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4755 +/- ##
==========================================
+ Coverage 95.01% 95.09% +0.07%
==========================================
Files 199 204 +5
Lines 7764 7865 +101
==========================================
+ Hits 7377 7479 +102
+ Misses 387 386 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PhongChuong
reviewed
Feb 23, 2026
Collaborator
PhongChuong
left a comment
There was a problem hiding this comment.
PR looks LGTM but I would be more ocnfident if there was a second set of eyes.
Collaborator
Author
|
@dbolduc do you want to be the second (or third) pair of eyes on this? |
dbolduc
approved these changes
Feb 23, 2026
Comment on lines
+86
to
+87
| remaining_time: Option<Duration>, | ||
| attempt_count: u32, |
Member
There was a problem hiding this comment.
Maybe this should be a struct so it can grow.
I know we can always plumb things via "internal" fields in the RequestOptions.... but I don't like that
dbolduc
approved these changes
Feb 23, 2026
dbolduc
approved these changes
Feb 23, 2026
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.
Most client libraries use
ReqwestClientto make HTTP+JSON RPCs. In the Storage client (and maybe in others) we need to make raw HTTP requests.These are different in seveal dimensions:
ReqwestClient, so callingexecute()is a problem.ReqwestClient's endpoint, so the host header needs adjustment.It was getting too hard to keep these things in mind, adding a new type makes it harder to use these incorrectly.
I also refactored some of the tests to remove duplicated code.
Towards #3178