public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (_context.IsSPFRequest() && IsHtmlResponse()) { _context.Response.ContentType = "application/json"; await SPFASPCOREInjectionHelper.InjectSpfCoreAsync(buffer, offset, count, _context, _baseStream); } else { await _baseStream.WriteAsync(buffer, offset, count, cancellationToken); } }
public override void Write(byte[] buffer, int offset, int count) { if (_context.IsSPFRequest() && IsHtmlResponse()) { SPFASPCOREInjectionHelper.InjectSpfCoreAsync(buffer, offset, count, _context, _baseStream) .GetAwaiter() .GetResult(); } else { _baseStream.Write(buffer, offset, count); } }