public ConstByteArrayHttpRequestHandler(byte[] content, HttpResponseCode code = HttpResponseCode.OK, string contentType = "application/octet-stream", bool keepALive = true) { Content = content; ContentType = contentType; Response = ByteArrayHttpResponse.Create(content, 0, content.Length, contentType: contentType, code: code, keepAlive: keepALive); }
public Task Handle(IHttpContext context, Func <Task> next) { var result = _method(context); if (result != null) { context.Response = ByteArrayHttpResponse.Create(result, 0, result.Length, contentType: _contentType); return(Task.Factory.GetCompleted()); } return(next()); }