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);
     }
 }
 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);
         }
     }
 }