Skip to content
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

Fix WebClient url encoding regression #79975

Merged
merged 1 commit into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
<Reference Include="System.Runtime" />
<Reference Include="System.Memory" />
<Reference Include="System.Threading" />
<Reference Include="System.Web.HttpUtility" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;

namespace System.Net
{
Expand Down Expand Up @@ -1175,7 +1176,7 @@ private string MapToDefaultMethod(Uri address)
[return: NotNullIfNotNull(nameof(str))]
private static string? UrlEncode(string? str) =>
str is null ? null :
WebUtility.UrlEncode(str);
HttpUtility.UrlEncode(str);

private void InvokeOperationCompleted(AsyncOperation asyncOp, SendOrPostCallback callback, AsyncCompletedEventArgs eventArgs)
{
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Net.WebClient/tests/WebClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public abstract class WebClientTestBase

const string ExpectedTextAfterUrlEncode =
"To+be%2c+or+not+to+be%2c+that+is+the+question%3a" +
"Whether+'tis+Nobler+in+the+mind+to+suffer" +
"Whether+%27tis+Nobler+in+the+mind+to+suffer" +
"The+Slings+and+Arrows+of+outrageous+Fortune%2c" +
"Or+to+take+Arms+against+a+Sea+of+troubles%2c" +
"And+by+opposing+end+them%3a";
Expand Down