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

[tests] Fix CRLF issues in M.E.Http #52707

Merged
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
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down Expand Up @@ -50,47 +51,47 @@ public async Task RedactHeaderValueWithHeaderList_ValueIsRedactedBeforeLogging()
m.EventId == LoggingScopeHttpMessageHandler.Log.EventIds.RequestHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Request Headers:
Authorization: *
Cache-Control: no-cache
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingHttpMessageHandler.Log.EventIds.RequestHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Request Headers:
Authorization: *
Cache-Control: no-cache
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingHttpMessageHandler.Log.EventIds.ResponseHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Response Headers:
X-Sensitive: *
Y-Non-Sensitive: innocuous value
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingScopeHttpMessageHandler.Log.EventIds.ResponseHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Response Headers:
X-Sensitive: *
Y-Non-Sensitive: innocuous value
", message.Message);
"), message.Message);
}

[Fact]
Expand Down Expand Up @@ -131,47 +132,47 @@ public async Task RedactHeaderValueWithPredicate_ValueIsRedactedBeforeLogging()
m.EventId == LoggingScopeHttpMessageHandler.Log.EventIds.RequestHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Request Headers:
Authorization: *
Cache-Control: no-cache
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingHttpMessageHandler.Log.EventIds.RequestHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Request Headers:
Authorization: *
Cache-Control: no-cache
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingHttpMessageHandler.Log.EventIds.ResponseHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Response Headers:
X-Sensitive: *
Y-Non-Sensitive: innocuous value
", message.Message);
"), message.Message);

message = Assert.Single(messages.Where(m =>
{
return
m.EventId == LoggingScopeHttpMessageHandler.Log.EventIds.ResponseHeader &&
m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler";
}));
Assert.StartsWith(
Assert.StartsWith(LineEndingsHelper.Normalize(
@"Response Headers:
X-Sensitive: *
Y-Non-Sensitive: innocuous value
", message.Message);
"), message.Message);
}

private class TestMessageHandler : HttpClientHandler
Expand Down
1 change: 0 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(BrowserHost)' == 'windows' and '$(RunDisabledWasmTestsOnWindows)' != 'true'">
<!-- Issue: https://github.com/dotnet/runtime/issues/52138 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Http\tests\Microsoft.Extensions.Http.Tests\Microsoft.Extensions.Http.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.Tests/System.Text.Json.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.CodeDom\tests\System.CodeDom.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression\tests\System.IO.Compression.Tests.csproj" />
Expand Down