Is there an existing issue for this?
Describe the bug
When adding an authorization header with TryAddWithoutValidation() to test error handling the value is still trimmed, removing trailing spaces.
Expected Behavior
I would expect that the non-validating function would also not mutate the value in any way, adding without trimming.
This would of course be a breaking change, so I would suggest a new parameter,
public bool TryAddWithoutValidation (string name, string? value, bool leaveMyValueAloneDamnitIKnowWhatIAmDoing=false);
My naming may be a little long winded
Steps To Reproduce
string headerValue = string.Empty();
request.Headers.TryAddWithoutValidation(HeaderNames.Authorization, "Test + " " + headerValue);
// Now check the authorization header and its value will be "Test", not "Test " as expected
Exceptions (if any)
No response
.NET Version
6.0.12
Anything else?
No response