public override Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken) { httpContext.Response.StatusCode = _statusCode; httpContext.Response.ContentType = _contentType; return(_stream.CopyToAsync(httpContext.Response.Body, 4096, cancellationToken)); }
public override async Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken) { httpContext.Response.StatusCode = _statusCode; if (_data != null) { await edgeSerializer.SerializeAsync(_data, httpContext.Response, cancellationToken); } }
public override async Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken) { httpContext.Response.StatusCode = _statusCode; var sWriter = new StreamWriter(httpContext.Response.Body); await sWriter.WriteAsync(_data); await sWriter.FlushAsync(); }
public override Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken) { var builder = new StringBuilder(); Serialize(_root, builder, 50); var bytes = Encoding.UTF8.GetBytes(builder.ToString()); httpContext.Response.ContentLength = bytes.Length; var response = httpContext.Response; return(response.Body.WriteAsync(bytes, 0, bytes.Length, cancellationToken)); }
public abstract Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken);
public override Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer, CancellationToken cancellationToken) { httpContext.Response.StatusCode = _statusCode; return(Task.FromResult(true)); }