Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
WebRequest.DefaultWebProxy: Set doesn't work without a previous Get (#…
Browse files Browse the repository at this point in the history
…22798)

* WebRequest.DefaultWebProxy: Set doesn't work without a previous Get
  • Loading branch information
arunjvs authored and danmoseley committed Sep 8, 2017
1 parent 3fbb419 commit fd5a525
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/System.Net.Requests/src/System/Net/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ public static IWebProxy DefaultWebProxy
lock (s_internalSyncObject)
{
s_DefaultWebProxy = value;
s_DefaultWebProxyInitialized = true;
}
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/System.Net.Requests/tests/WebRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
using Xunit;

namespace System.Net.Tests
{
public class WebRequestTest
public class WebRequestTest : RemoteExecutorTestBase
{
static WebRequestTest()
{
Expand All @@ -28,6 +29,20 @@ public void DefaultWebProxy_VerifyDefaults_Success()

Assert.Null(initialDefaultWebProxyCredentials);
}

[Fact]
public void DefaultWebProxy_SetThenGet_ValuesMatch()
{
RemoteInvoke(() =>
{
IWebProxy p = new WebProxy();
WebRequest.DefaultWebProxy = p;
Assert.Same(p, WebRequest.DefaultWebProxy);
return SuccessExitCode;
}).Dispose();
}

[Fact]
public void DefaultWebProxy_SetCredentialsToNullThenGet_ValuesMatch()
Expand Down

0 comments on commit fd5a525

Please sign in to comment.