-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(AzureTranslator): remove HttpClient service inject #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves the explicit registration of the default HttpClient factory from the Azure Translator DI setup, relying instead on the hosting application's own HttpClient configuration while keeping the AzureTranslator service and options registrations unchanged. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/components/BootstrapBlazor.AzureTranslator/Extensions/ServiceCollectionExtensions.cs:23` </location>
<code_context>
public static IServiceCollection AddBootstrapBlazorAzureTranslator(this IServiceCollection services, Action<
AzureTranslatorOption>? configOptions = null)
{
- services.AddHttpClient();
-
services.AddSingleton<IAzureTranslatorService, AzureTranslatorService>();
</code_context>
<issue_to_address>
**issue (bug_risk):** Removing AddHttpClient may break existing consumers that relied on this extension to register HttpClient.
This now requires applications to register `AddHttpClient` themselves. If `AzureTranslatorService` (or its dependencies) use `HttpClient`/`IHttpClientFactory`, callers that only invoke `AddBootstrapBlazorAzureTranslator(...)` may see runtime failures. If this is intentional, please document the new requirement and verify all consumers already configure `HttpClient`, or add a clearer guard/failure mode around the dependency.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/components/BootstrapBlazor.AzureTranslator/Extensions/ServiceCollectionExtensions.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes an unnecessary AddHttpClient() service registration from the AzureTranslator component and bumps the version to 10.0.1. The removal is appropriate since the AzureTranslatorService implementation uses the Azure SDK's TextTranslationClient, which manages its own HTTP communication internally, rather than requiring an injected HttpClient or IHttpClientFactory.
Key changes:
- Removed unnecessary
services.AddHttpClient()call from service registration - Bumped package version to 10.0.1
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ServiceCollectionExtensions.cs | Removed unnecessary HttpClient service registration that was not being used by AzureTranslatorService |
| BootstrapBlazor.AzureTranslator.csproj | Added explicit version 10.0.1 to the project properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Link issues
fixes #892
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enhancements: