-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// <copyright file="TestMiddleware.cs" company="OpenTelemetry Authors"> | ||
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net6.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net8.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-report (windows-latest)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net462)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-experimental (windows-latest, net7.0)
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-stable
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-stable
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-stable
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-experimental
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-experimental
Check warning on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / check-format-experimental
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
Check failure on line 1 in test/TestApp.AspNetCore/TestMiddleware.cs GitHub Actions / build-test-stable (windows-latest, net7.0)
|
||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
namespace TestApp.AspNetCore; | ||
|
||
public static class TestMiddleware | ||
{ | ||
private static readonly AsyncLocal<Action<IApplicationBuilder>?> Current = new(); | ||
|
||
public static IApplicationBuilder AddTestMiddleware(this IApplicationBuilder builder) | ||
{ | ||
if (Current.Value is { } configure) | ||
{ | ||
configure(builder); | ||
} | ||
|
||
return builder; | ||
} | ||
|
||
public static void Create(Action<IApplicationBuilder> action) | ||
{ | ||
Current.Value = action; | ||
} | ||
} |