21 lines
597 B
C#
21 lines
597 B
C#
using Flypaper.Core.Abstractions;
|
|
using Flypaper.Core.Models;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace Flypaper.Http;
|
|
|
|
internal sealed class HttpTrapChannel(TrapSession session, HttpResponse response) : ITrapChannel
|
|
{
|
|
public TrapSession Session => session;
|
|
|
|
public string? Path => response.HttpContext.Request.Path.Value;
|
|
|
|
public string? Host => response.HttpContext.Request.Host.Host;
|
|
|
|
public async ValueTask WriteAsync(ReadOnlyMemory<byte> data, CancellationToken ct)
|
|
{
|
|
await response.Body.WriteAsync(data, ct);
|
|
await response.Body.FlushAsync(ct);
|
|
}
|
|
}
|