-
Notifications
You must be signed in to change notification settings - Fork 33
Commit 9232e86
fix: handle duplicate keys in logger state to prevent ArgumentException
Replaces ToDictionary() with manual dictionary population to handle duplicate keys
that can occur with HTTP headers (e.g., multiple Content-Type headers).
The last value wins for duplicate keys, maintaining existing behavior.
Performance improvements:
- O(n) complexity instead of O(n log n) from GroupBy
- Single pass enumeration
- No LINQ overhead or intermediate collections
Fixes issue where curl requests with duplicate headers caused:
"An item with the same key has already been added. Key: Content-Type"
Adds test case for duplicate key scenarios.1 parent 2a131e3 commit 9232e86
File tree
2 files changed
+59
-5
lines changed- libraries
- src/AWS.Lambda.Powertools.Logging/Internal
- tests/AWS.Lambda.Powertools.Logging.Tests
2 files changed
+59
-5
lines changedLines changed: 17 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
396 | 396 |
| |
397 | 397 |
| |
398 | 398 |
| |
399 | - | ||
400 | - | ||
399 | + | ||
400 | + | ||
401 | + | ||
402 | + | ||
403 | + | ||
404 | + | ||
405 | + | ||
406 | + | ||
401 | 407 |
| |
402 | - | ||
403 | - | ||
408 | + | ||
409 | + | ||
410 | + | ||
411 | + | ||
412 | + | ||
413 | + | ||
414 | + | ||
415 | + | ||
404 | 416 |
| |
405 | 417 |
| |
406 | - | ||
418 | + | ||
407 | 419 |
| |
408 | 420 |
| |
409 | 421 |
| |
|
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1750 | 1750 |
| |
1751 | 1751 |
| |
1752 | 1752 |
| |
1753 | + | ||
1754 | + | ||
1755 | + | ||
1756 | + | ||
1757 | + | ||
1758 | + | ||
1759 | + | ||
1760 | + | ||
1761 | + | ||
1762 | + | ||
1763 | + | ||
1764 | + | ||
1765 | + | ||
1766 | + | ||
1767 | + | ||
1768 | + | ||
1769 | + | ||
1770 | + | ||
1771 | + | ||
1772 | + | ||
1773 | + | ||
1774 | + | ||
1775 | + | ||
1776 | + | ||
1777 | + | ||
1778 | + | ||
1779 | + | ||
1780 | + | ||
1781 | + | ||
1782 | + | ||
1783 | + | ||
1784 | + | ||
1785 | + | ||
1786 | + | ||
1787 | + | ||
1788 | + | ||
1789 | + | ||
1790 | + | ||
1791 | + | ||
1792 | + | ||
1793 | + | ||
1794 | + | ||
1753 | 1795 |
| |
1754 | 1796 |
| |
1755 | 1797 |
| |
|
0 commit comments