Exemplo n.º 1
0
 public override void Write(byte[] buffer, int offset, int count)
 {
     if (IsHtmlResponse())
     {
         ScriptInjectionHelper.InjectScriptAsync(buffer.AsMemory(offset, count), _context, _baseStream)
         .GetAwaiter()
         .GetResult();
     }
     else
     {
         _baseStream?.Write(buffer, offset, count);
     }
 }
Exemplo n.º 2
0
 public override async ValueTask WriteAsync(ReadOnlyMemory <byte> buffer, CancellationToken cancellationToken = default)
 {
     if (IsHtmlResponse())
     {
         await ScriptInjectionHelper.InjectScriptAsync(buffer, _context, _baseStream);
     }
     else
     {
         if (_baseStream != null)
         {
             await _baseStream.WriteAsync(buffer, cancellationToken);
         }
     }
 }