Skip to content
Merged
Changes from 1 commit
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
Next Next commit
fix HttpClientHandlerTest.RemoteServer.cs
  • Loading branch information
Jan Jahoda committed Nov 2, 2021
commit 1203e62419444e28aa2f04885c3261d8a6c1f94a
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public async Task GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCo
handler.Credentials = CredentialCache.DefaultCredentials;
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler))
{
Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
Expand All @@ -153,7 +153,7 @@ public async Task GetAsync_ServerNeedsAuthAndSetCredential_StatusCodeOK(Configur
handler.Credentials = _credential;
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler))
{
Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Expand All @@ -167,7 +167,7 @@ public async Task GetAsync_ServerNeedsAuthAndNoCredential_StatusCodeUnauthorized
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
{
Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
Expand Down Expand Up @@ -1033,7 +1033,7 @@ public async Task GetAsync_AllowAutoRedirectTrue_RedirectToUriWithParams_Request
{
HttpClientHandler handler = CreateHttpClientHandler();
handler.AllowAutoRedirect = true;
Uri targetUri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri targetUri = remoteServer.BasicAuthUriForCreds(Username, Password);
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler))
{
Uri uri = remoteServer.RedirectUriForDestinationUri(
Expand Down Expand Up @@ -1133,8 +1133,8 @@ public async Task GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUn
{
Uri redirectUri = remoteServer.RedirectUriForCreds(
statusCode: 302,
userName: Username,
password: Password);
Username,
Password);
using (HttpResponseMessage unAuthResponse = await client.GetAsync(redirectUri))
{
Assert.Equal(HttpStatusCode.Unauthorized, unAuthResponse.StatusCode);
Expand All @@ -1153,15 +1153,15 @@ public async Task HttpClientHandler_CredentialIsNotCredentialCacheAfterRedirect_
{
Uri redirectUri = remoteServer.RedirectUriForCreds(
statusCode: 302,
userName: Username,
password: Password);
Username,
Password);
using (HttpResponseMessage unAuthResponse = await client.GetAsync(redirectUri))
{
Assert.Equal(HttpStatusCode.Unauthorized, unAuthResponse.StatusCode);
}

// Use the same handler to perform get request, authentication should succeed after redirect.
Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password);
using (HttpResponseMessage authResponse = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, authResponse.StatusCode);
Expand All @@ -1180,11 +1180,11 @@ public async Task GetAsync_CredentialIsCredentialCacheUriRedirect_StatusCodeOK(C
return;
}

Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password);
Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password);
Uri redirectUri = remoteServer.RedirectUriForCreds(
statusCode: statusCode,
userName: Username,
password: Password);
Username,
Password);
_output.WriteLine(uri.AbsoluteUri);
_output.WriteLine(redirectUri.AbsoluteUri);
var credentialCache = new CredentialCache();
Expand Down