public void CopyTo(bool chunk, WritableChannelFormatter outputFormatter) { foreach (var header in _headers) { outputFormatter.Write(_headersStartBytes); outputFormatter.Append(header.Key); outputFormatter.Write(_headersSeperatorBytes); outputFormatter.Append(header.Value.ToString()); } if (chunk) { outputFormatter.Write(_chunkedHeaderBytes); } outputFormatter.Write(_serverHeaderBytes); var date = _dateHeaderValueManager.GetDateHeaderValues().Bytes; outputFormatter.Write(date); outputFormatter.Write(_headersEndBytes); }
public Task WriteAsync(Span<byte> data) { if (!HasStarted) { WriteBeginResponseHeaders(); } if (_autoChunk) { _outputFormatter.Append(data.Length, Format.Parsed.HexLowercase); _outputFormatter.Write(data); _outputFormatter.Write(_endChunkBytes); } else { _outputFormatter.Write(data); } return _outputFormatter.FlushAsync(); }
public Task HandleAsync(Line message) { // Echo back to the caller _formatter.Append(message.Data); return(_formatter.FlushAsync()); }