Esempio n. 1
0
 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));
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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));
        }
Esempio n. 5
0
 public abstract Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer,
                                 CancellationToken cancellationToken);
Esempio n. 6
0
 public override Task WriteAsync(HttpContext httpContext, IEdgeSerializer edgeSerializer,
                                 CancellationToken cancellationToken)
 {
     httpContext.Response.StatusCode = _statusCode;
     return(Task.FromResult(true));
 }