Skip to content

Conversation

@skg-marimuthu
Copy link
Contributor

Refactoring/Streamlining HttpClient creations and capture user agent

@skg-marimuthu skg-marimuthu requested a review from a team as a code owner December 19, 2025 23:48
Copilot AI review requested due to automatic review settings December 19, 2025 23:48
@skg-marimuthu skg-marimuthu requested a review from a team as a code owner December 19, 2025 23:48
Copy link
Contributor

Copilot AI left a 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 refactors HttpClient creation throughout the codebase to use a centralized HttpClientFactory that standardizes authentication, user agent, and content type headers. The factory reduces code duplication and ensures consistent header configuration across all HTTP requests.

  • Introduces a new HttpClientFactory.CreateAuthenticatedClient() method that handles Bearer token authentication and sets standard headers
  • Replaces all manual HttpClient instantiation and header configuration with factory calls
  • Reorganizes using statements to follow Microsoft namespace ordering conventions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
GraphApiService.cs Updates constructor to use HttpClientFactory.CreateAuthenticatedClient() when no custom handler is provided
DelegatedConsentService.cs Replaces manual HttpClient creation and authentication header setup with factory call
A365CreateInstanceRunner.cs Refactors seven instances of HttpClient creation to use the factory for token acquisition, user operations, and Graph API calls
BlueprintSubcommand.cs Converts four HttpClient instances to use factory pattern; reorders using statements and removes unused imports
PublishCommand.cs Switches to factory-based HttpClient creation for MOS token-based operations; reorders using statements

@skg-marimuthu skg-marimuthu enabled auto-merge (squash) December 20, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants