feat: hide pipelines internals from stack trace
All checks were successful
default / dotnet-default-workflow (pull_request) Successful in 2m4s
default / dotnet-default-workflow (push) Successful in 1m59s

This commit is contained in:
Louis Seubert 2026-05-29 22:53:58 +02:00
commit 4d33d5ab4c
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
5 changed files with 87 additions and 4 deletions

View file

@ -1,14 +1,19 @@
// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
using System.Runtime.CompilerServices;
namespace Geekeey.Request.Dispatcher.Tests;
public class StreamOpenBehavior<TRequest, TResponse>(StreamTestTracker tracker) : IStreamRequestBehavior<TRequest, TResponse>
where TRequest : IStreamRequest<TResponse>
{
public IAsyncEnumerable<TResponse> HandleAsync(TRequest request, StreamHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
public async IAsyncEnumerable<TResponse> HandleAsync(TRequest request, StreamHandlerDelegate<TResponse> next, [EnumeratorCancellation] CancellationToken cancellationToken)
{
tracker.Executed = true;
return next(request, cancellationToken);
await foreach (var response in next(request, cancellationToken))
{
yield return response;
}
}
}