Skip to content

Commit

Permalink
Fix WebClient url encoding casing (#79975)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed Dec 27, 2022
1 parent a650a39 commit 89b2740
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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

0 comments on commit 89b2740

Please sign in to comment.