Skip to content

Commit d67aff5

Browse files
committed
Fix CallTestApplicationEndpoint
1 parent 05ce31b commit d67aff5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/IntegrationTests/AspNetTests.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ public class AspNetTests
1212
{
1313
private const string ServiceName = "TestApplication.AspNet.NetFramework";
1414

15-
private static readonly HttpClient Client = new();
15+
private static readonly HttpClient Client = new()
16+
{
17+
DefaultRequestHeaders =
18+
{
19+
{ "Custom-Request-Test-Header1", "Test-Value1" },
20+
{ "Custom-Request-Test-Header2", "Test-Value2" },
21+
{ "Custom-Request-Test-Header3", "Test-Value3" }
22+
}
23+
};
1624

1725
public AspNetTests(ITestOutputHelper output)
1826
{
@@ -235,10 +243,6 @@ private static string GetTestImageName(AppPoolMode appPoolMode, Gac useGac)
235243

236244
private async Task CallTestApplicationEndpoint(int webPort)
237245
{
238-
Client.DefaultRequestHeaders.Add("Custom-Request-Test-Header1", "Test-Value1");
239-
Client.DefaultRequestHeaders.Add("Custom-Request-Test-Header2", "Test-Value2");
240-
Client.DefaultRequestHeaders.Add("Custom-Request-Test-Header3", "Test-Value3");
241-
242246
var response = await Client.GetAsync(new Uri($"http://localhost:{webPort}")).ConfigureAwait(false);
243247
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
244248
Output.WriteLine("MVC Response:");

0 commit comments

Comments
 (0)