예제 #1
0
 public async Task Invoke(HttpContext context)
 {
     if (context.Request.Path.HasValue && string.Equals(context.Request.Path.Value.Trim('/'), _indexPath.Trim('/'), StringComparison.OrdinalIgnoreCase))
     {
         var stream = typeof(SigSpecUIIndexMiddleware).GetTypeInfo().Assembly.GetManifestResourceStream(_resourcePath);
         using (var reader = new StreamReader(stream))
         {
             context.Response.Headers["Content-Type"] = "text/html; charset=utf-8";
             context.Response.StatusCode = 200;
             await context.Response.WriteAsync(_settings.TransformHtml(await reader.ReadToEndAsync(), context.Request));
         }
     }
     else
     {
         await _nextDelegate(context);
     }
 }