public List <EventContext> ToEventContext(HttpRequest request) { using var readStream = new StreamReader( request.BodyReader.AsStream(), Encoding.UTF8 ); var contexts = JsonSerializer.Deserialize <List <object> >(readStream.ReadToEnd()) .Select(payload => { try { return(_factory.Create(request.HttpContext, payload)); } catch (Exception e) { Console.WriteLine(e.Message); } return(null); }) .Where(payload => null != payload) .ToList(); return(contexts); }
public async Task Next(HttpContext context, Func <Task> next) { var loggerHttpContext = factory.Create(context); await next.Invoke(); await queueWriter.Emit(loggerHttpContext); }