-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HttpHeaders.TryAddWithoutValidation different behaviour between .net 6 and .net 7/8 #111065
Comments
Tagging subscribers to this area: @dotnet/ncl |
The You should remove the existing header first, or preferably use the constructor itself to set the value What you're looking at is the result of a bugfix for #63833 that stopped reordering invalid/unparsed values in the list when sending those over the network. |
This issue has been marked |
Thank you for your explanation. We were already able to fix this issue. This ticket was created just to confirm, that this is a known and intended behaviour change. We can close this ticket. Thank you for your help. |
Description
HttpHeaders.TryAddWithoutValidation different behaviour between .net 6 and .net 7/8.
Reproduction Steps
Create simple console application:
If you create this application in .net 6 you will receive result:
Content-Type: application/json, text/plain; charset=utf-8
application/json
will be first and separated from defaulttext/plain; charset=utf-8
by a coma.In .net 7 or .net 8 you will receive:
Content-Type: text/plain; charset=utf-8, application/json
application/json
is last.This creates problems because later when we are sending
HttpRequestMessage
onlytext/plain
is sent and we receive415 Unsupported Media Type
response.Expected behavior
Results from .net 6 would be expected.
Actual behavior
Results from .net 8.
Regression?
No response
Known Workarounds
Check if you already have header before you use
TryAddWithoutValidation
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: