Skip to content

Conversation

@hamzamahmood
Copy link
Collaborator

What

This PR replaces the internal parameter collection inside Parameter.Builder with a ConcurrentDictionary<string, Parameter>, using each parameter’s key as the dictionary key.

Why

Previously, we used a ConcurrentBag to collect parameters, which:

  • Caused duplicates when multiple parameters had the same key.
  • Introduced ordering issues.
  • Allowed stale values (e.g., expired tokens) to be reused unintentionally.

The new implementation:

  • Ensures only one entry per parameter key (latest value wins).
  • Resolves long-standing parameter accumulation issues across requests.
  • Aligns with expected AuthManager behavior (i.e., always using the most recent token).
  • Maintains thread safety while improving correctness.

Type of change

Select multiple if applicable.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause a breaking change)
  • Tests (adds or updates tests)
  • Documentation (adds or updates documentation)
  • Refactor (style improvements, performance improvements, code refactoring)
  • Revert (reverts a commit)
  • CI/Build (adds or updates a script, change in external dependencies)

Checklist

  • My code follows the coding conventions
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added new unit tests

@hamzamahmood hamzamahmood self-assigned this Jul 21, 2025
@hamzamahmood hamzamahmood added the bug Something isn't working label Jul 21, 2025
asadali214
asadali214 previously approved these changes Jul 22, 2025
…nce for duplicate keys in additional form, query, and header parameters
@sonarqubecloud
Copy link

@asadali214 asadali214 merged commit ff138ea into main Jul 22, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants