feat: add HttpClientFactory option to HttpOptions for custom HttpClient configuration#234
Open
niimima wants to merge 3 commits intogoogleapis:mainfrom
Open
feat: add HttpClientFactory option to HttpOptions for custom HttpClient configuration#234niimima wants to merge 3 commits intogoogleapis:mainfrom
niimima wants to merge 3 commits intogoogleapis:mainfrom
Conversation
|
Hi @niimima Thank you for your contribution. Please check the failing checks and update the same. |
# Conflicts: # Google.GenAI.Tests/HttpApiClientTest.cs # Google.GenAI/ApiClient.cs
Author
|
@shivvaam0001 I've fixed the failing checks and updated the PR. Please let me know if anything else needs to be addressed. |
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.
Summary
Add
HttpClientFactorytoHttpOptionsto allow callers to provide a customHttpClientinstance.This enables advanced configuration scenarios such as:
Changes
Func<HttpClient>? HttpClientFactoryproperty toHttpOptions[JsonIgnore]to prevent serializationMotivation
In some environments, users need to control how
HttpClientinstances are created(e.g., using
IHttpClientFactory, custom handlers, or proxy settings).This change allows consumers of the library to inject their own
HttpClientwithout modifying the internal HTTP pipeline.
Example
Compatibility
This change is backward compatible since the new property is optional.