Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deltragon
Copy link

@deltragon deltragon commented Jan 30, 2022

Split out of #21247, as it is a separate simple change and also fixes a bug.

By default, .NET does not append the charset to the Content-Type header if the response is empty. This was corrected in mono in #866.
However, as soon as any content is written to the response, it should append the charset. When just using HttpResponse.Write(), this defaults to utf-8.
(Note: I reverse-engineered this behavior from the referencesource.)

This PR fixes this behavior, and adds an additional testcase for the non-empty response.
This testcase has not been run on windows/.NET, as I do not have mono set up there. Does someone else need to check if this test passes on .NET or is this checked as part of CI?

Fixes https://bugzilla.xamarin.com/23/23810/bug.html

@deltragon
Copy link
Author

I am not sure if the CI failures are my fault? If they are, I don't understand the output properly.

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.

1 participant