Skip to content

Conversation

gladjohn
Copy link
Contributor

@gladjohn gladjohn commented Aug 14, 2025

Fixes #5439

Changes proposed in this request
This pull request adds a comprehensive new unit test class, ExtraHttpHeadersTests, to verify the behavior of the WithExtraHttpHeaders API in the token acquisition flow. The tests ensure that custom HTTP headers are correctly sent, default headers remain unaffected by null input, user headers can override defaults, and repeated calls to set headers behave as expected.

New test coverage for extra HTTP headers

  • Added ExtraHttpHeadersTests class to validate WithExtraHttpHeaders functionality in AcquireTokenForClient, including scenarios for sending custom headers, listing all headers, handling null values, overriding defaults, and ensuring last call precedence.
  • Implemented helper methods (TryGetHeader, EnumerateAllHeaders, and AssertHeaderExists) to facilitate header validation and assertions within the tests.

Testing
unit tests

Performance impact
none

Documentation

  • All relevant documentation is updated.

@gladjohn gladjohn requested a review from a team as a code owner August 14, 2025 22:02
Copy link
Member

@bgavrilMS bgavrilMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already exposed in the namespace Microsoft.Identity.Client.Advanced

@gladjohn gladjohn force-pushed the gladjohn/expose_header_in_acq_client branch from 59e572f to d43a52a Compare August 15, 2025 13:15
@gladjohn gladjohn changed the title Added the WithExtraHttpHeaders(IDictionary<string, string> extraHttpHeaders) method to AcquireTokenForClientParameterBuilder Added tests for WithExtraHttpHeaders on AcquireTokenForClient Aug 15, 2025
@gladjohn gladjohn changed the title Added tests for WithExtraHttpHeaders on AcquireTokenForClient Introduces a the extensibility API to allow users to add custom HTTP headers to token acquisition requests (under extensibility) Aug 15, 2025
@gladjohn gladjohn changed the title Introduces a the extensibility API to allow users to add custom HTTP headers to token acquisition requests (under extensibility) Introduces the extensibility API to allow users to add custom HTTP headers to token acquisition requests (under extensibility) Aug 15, 2025
@gladjohn gladjohn force-pushed the gladjohn/expose_header_in_acq_client branch from 49d0634 to dd54631 Compare August 18, 2025 21:22
@gladjohn gladjohn force-pushed the gladjohn/expose_header_in_acq_client branch from 9f514b0 to 262eaa6 Compare August 18, 2025 21:30
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.

[Feature Request] Add new WithCustomHeaders() Api while acquiring token via MSAL

4 participants